asdf-nodejs
asdf-nodejs copied to clipboard
bug: Asdf nodejs plugin inside alpine container : ~/.asdf/installs/nodejs/17.3.0/bin/node: No such file or directory
Describe the Bug
I try to install asdf with nodejs plugin in an alpine docker container.
While it works in an ubuntu 18.04 docker image, it fails in alpine.
Steps to Reproduce
Start of the Dockerfile
FROM ubuntu:18.04
RUN apt-get update -q && apt-get install -y \
curl \
git
And
FROM alpine:latest
RUN apk --no-cache add bash git curl
End of the Dockerfile
RUN adduser --shell /bin/bash --home /ci --disabled-password ci
ENV PATH="${PATH}:/ci/.asdf/shims:/ci/.asdf/bin"
ENV NODEJS_CHECK_SIGNATURES=no
USER ci
WORKDIR /ci
RUN git clone --depth 1 https://github.com/asdf-vm/asdf.git $HOME/.asdf && \
echo '. $HOME/.asdf/asdf.sh' >> $HOME/.bashrc && \
echo '. $HOME/.asdf/asdf.sh' >> $HOME/.profile
RUN asdf plugin-add nodejs
RUN asdf install nodejs latest
RUN asdf global nodejs latest
# With Ubuntu 18.04, this works. With alpine, this fails with the error:
# /ci/.asdf/lib/commands/command-exec.bash: line 28: /ci/.asdf/installs/nodejs/17.3.0/bin/node: No such file or directory
# STDERR: The command '/bin/sh -c node --version' returned a non-zero code: 127
RUN node --version
RUN npm -v
Expected Behaviour
Node shoud be found like in ubuntu. I checked inside the container with a ls /ci/.asdf/installs/nodejs/17.3.0/bin and the node file exists.
Actual Behaviour
I get the error:
/ci/.asdf/lib/commands/command-exec.bash: line 28: /ci/.asdf/installs/nodejs/17.3.0/bin/node: No such file or directory STDERR: The command '/bin/sh -c node --version' returned a non-zero code: 127
Environment
OS:
Linux 0fdc9c1601ae 5.8.0-45-generic asdf-vm/asdf#51~20.04.1-Ubuntu SMP Tue Feb 23 13:46:31 UTC 2021 x86_64 Linux
SHELL:
GNU bash, version 5.1.8(1)-release (x86_64-alpine-linux-musl)
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
ASDF VERSION:
v0.9.0-87137e4
ASDF ENVIRONMENT VARIABLES:
ASDF INSTALLED PLUGINS:
nodejs https://github.com/asdf-vm/asdf-nodejs.git master ed34355
asdf plugins affected (if relevant)
nodejs
I have moved this issue to the asdf-nodejs repo as I believe it's specific to nodejs.
ENV PATH="${PATH}:/ci/.asdf/shims:/ci/.asdf/bin"
You shouldn't need that line. And if you want to manually set the path asdf dirs should come before everything else.
What happens if you run asdf reshim prior to trying to use node?
node-build does not yet support musl libc: https://github.com/nodenv/node-build/issues/722
Hello @trompx, check if after following the steps on https://github.com/asdf-vm/asdf-nodejs/issues/190#issuecomment-1034334159 you can get it working.
This is a bit old but I'm seeing a similar behavior on alpine in my docker container. But mine looks like:
bash: /root/.asdf/installs/nodejs/19.1.0/bin/node: cannot execute: required file not found
Any progress on this? I'm not even sure how to debug this.
This likely an issue that is resolved by installing libc6-compat. Add this to the alpine dockerfile:
RUN apk update && apk upgrade && apk add bash libc6-compat
@augustobmoura do you want to close this issue? Or is there something else we can do for it?
Let's close this in favor of #190, we can keep the discussion over there