Bumbus
I have problem get VegaLite.Export.to_svg() to run in a docker container. The image is based on a tweaked Dockerfile generated with mix phx.gen.release --docker, like this:
# Find eligible builder and runner images on Docker Hub. We use Ubuntu/Debian
# instead of Alpine to avoid DNS resolution issues in production.
#
# https://hub.docker.com/r/hexpm/elixir/tags?page=1&name=ubuntu
# https://hub.docker.com/_/ubuntu?tab=tags
#
# This file is based on these images:
#
# - https://hub.docker.com/r/hexpm/elixir/tags - for the build image
# - https://hub.docker.com/_/debian?tab=tags&page=1&name=bullseye-20210902-slim - for the release image
# - https://pkgs.org/ - resource for finding needed packages
# - Ex: hexpm/elixir:1.14.1-erlang-23.3.4.4-debian-bullseye-20210902-slim
#
ARG ELIXIR_VERSION=1.14.1
ARG OTP_VERSION=23.3.4.4
ARG DEBIAN_VERSION=bullseye-20210902-slim
ARG BUILDER_IMAGE="hexpm/elixir:${ELIXIR_VERSION}-erlang-${OTP_VERSION}-debian-${DEBIAN_VERSION}"
ARG RUNNER_IMAGE="debian:${DEBIAN_VERSION}"
FROM ${BUILDER_IMAGE} as builder
# install build dependencies
RUN apt-get update -y && apt-get install -y build-essential git \
&& apt-get clean && rm -f /var/lib/apt/lists/*_*
# prepare build dir
WORKDIR /app
# install hex + rebar
RUN mix local.hex --force && \
mix local.rebar --force
# set build ENV
ENV MIX_ENV="prod"
# install mix dependencies
COPY mix.exs mix.lock ./
RUN mix deps.get --only $MIX_ENV
RUN mkdir config
# copy compile-time config files before we compile dependencies
# to ensure any relevant config change will trigger the dependencies
# to be re-compiled.
COPY config/config.exs config/${MIX_ENV}.exs config/
RUN mix deps.compile
COPY priv priv
COPY lib lib
COPY assets assets
# compile assets
RUN mix assets.deploy
# Compile the release
RUN mix compile
# Changes to config/runtime.exs don't require recompiling the code
COPY config/runtime.exs config/
COPY rel rel
RUN mix release
# start a new build stage so that the final image will only contain
# the compiled release and other runtime necessities
FROM ${RUNNER_IMAGE}
RUN apt-get update -y && apt-get install -y libstdc++6 openssl libncurses5 locales curl chromium gcc g++ make build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev \
&& apt-get clean && rm -f /var/lib/apt/lists/*_*
# Set the locale
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
apt-get install -y nodejs
RUN node --version
RUN npm install -g vega vega-lite canvas
WORKDIR "/app"
# RUN chown nobody /app
# set runner ENV
ENV MIX_ENV="prod"
# Only copy the final release from the build stage
COPY --from=builder /app/_build/${MIX_ENV}/rel/vega ./
# COPY --from=builder --chown=nobody:root /app/_build/${MIX_ENV}/rel/vega ./
# USER nobody
CMD ["/app/bin/server"]
The logs for this container show this error:
14:38:48.616 [info] Running VegaWeb.Endpoint with cowboy 2.9.0 at :::4000 (http)
14:38:48.617 [info] Access VegaWeb.Endpoint at http://localhost:443
14:38:50.325 request_id=F08TOwoSlyo1rTcAAAAD [info] GET /
14:38:50.325 request_id=F08TOwoSlyo1rTcAAAAD [debug] Processing with VegaWeb.PageController.home/2
Parameters: %{}
Pipelines: [:browser]
14:38:50.644 request_id=F08TOwoSlyo1rTcAAAAD [info] Sent 500 in 318ms
14:38:50.644 request_id=F08TOwoSlyo1rTcAAAAD [debug] Converted error {:badmatch, {"Unknown command: \"bin\"\n\nTo see a list of supported npm commands, run:\n npm help\n", 1}} to 500 response
14:38:50.645 [error] #PID<0.1642.0> running VegaWeb.Endpoint (connection #PID<0.1641.0>, stream id 1) terminated
Server: localhost:4000 (http)
Request: GET /
** (exit) an exception was raised:
** (MatchError) no match of right hand side value: {"Unknown command: \"bin\"\n\nTo see a list of supported npm commands, run:\n npm help\n", 1}
(vega_lite 0.1.6) lib/vega_lite/export.ex:186: VegaLite.Export.npm_bin/2
(vega_lite 0.1.6) lib/vega_lite/export.ex:162: VegaLite.Export.find_npm_script!/2
(vega_lite 0.1.6) lib/vega_lite/export.ex:146: VegaLite.Export.node_convert/3
(vega 0.1.0) lib/vega_web/controllers/page_html/home.html.heex:3: anonymous fn/2 in VegaWeb.PageHTML.home/1
(phoenix_live_view 0.18.18) lib/phoenix_live_view/engine.ex:137: Phoenix.HTML.Safe.Phoenix.LiveView.Rendered.to_iodata/1
(phoenix_live_view 0.18.18) lib/phoenix_live_view/engine.ex:153: Phoenix.HTML.Safe.Phoenix.LiveView.Rendered.to_iodata/3
(phoenix 1.7.2) lib/phoenix/controller.ex:1010: anonymous fn/5 in Phoenix.Controller.template_render_to_iodata/4
(telemetry 1.2.1) /app/deps/telemetry/src/telemetry.erl:321: :telemetry.span/3
Someone knows how to fix this issue?
It looks like it does not find the actual node executable or so?
Thanks for help! ![]()
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #security











Showing Posts 1 to 4- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
Bumbus
I created a small repo to reproduce the error here:
https://github.com/bumbus/docker_vega_phoenix
al2o3cr
Looks like the command that that code tries to run (
npm bin) was removed for NPM 9.0:https://github.com/npm/cli/pull/5459
Bumbus
Good find, thank you for pointing me into the right direction. I saw you already created an issue at github:
https://github.com/livebook-dev/vega_lite/issues/43
Thank you very much for your help.
Bumbus
So the temporary solution for the original problem would be to install an older node version. It looks like version 16 works in this case: