nvm: env: ‘node’: No such file or directory error in alpine linux (docker)
Operating system and version:
Alpine linux 3.12.0
nvm debug
output:
nvm --version: v0.35.3
$SHELL:
$SHLVL: 1
${HOME}: /root
${NVM_DIR}: '/bin'
${PATH}: /usr/local/sbin:/usr/local${NVM_DIR}:/usr/sbin:/usr${NVM_DIR}:/sbin:${NVM_DIR}
$PREFIX: ''
${NPM_CONFIG_PREFIX}: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
/bin/sh: --version: not found
shell version: ''
uname -a: 'Linux 4.19.76-linuxkit #1 SMP Tue May 26 11:42:35 UTC 2020 x86_64 GNU/Linux'
OS version: Welcome to Alpine Linux 3.12
curl: /usr/bin/curl, curl 7.69.1 (x86_64-alpine-linux-musl) libcurl/7.69.1 OpenSSL/1.1.1g zlib/1.2.11 nghttp2/1.41.0
wget: unrecognized option: V
BusyBox v1.31.1 () multi-call binary.
Usage: wget [-c|--continue] [--spider] [-q|--quiet] [-O|--output-document FILE]
[-o|--output-file FILE] [--header 'header: value'] [-Y|--proxy on/off]
[-P DIR] [-S|--server-response] [-U|--user-agent AGENT] [-T SEC] URL...
Retrieve files via HTTP or FTP
--spider Only check URL existence: $? is 0 if exists
-c Continue retrieval of aborted transfer
-q Quiet
-P DIR Save to DIR (default .)
-S Show server response
-T SEC Network read timeout is SEC seconds
-O FILE Save to FILE ('-' for stdout)
-o FILE Log messages to FILE
-U STR Use STR for User-Agent header
-Y on/off Use proxy
wget: /usr/bin/wget,
git: not found
grep: /bin/grep, grep (GNU grep) 3.4
awk: /usr/bin/awk, BusyBox v1.31.1 () multi-call binary.
sed: /bin/sed, BusyBox v1.31.1 () multi-call binary.
cut: /usr/bin/cut, cut (GNU coreutils) 8.32
basename: /usr/bin/basename, basename (GNU coreutils) 8.32
rm: /bin/rm, rm (GNU coreutils) 8.32
mkdir: /bin/mkdir, mkdir (GNU coreutils) 8.32
xargs: /usr/bin/xargs, xargs (GNU findutils) 4.7.0
nvm current: none
which node:
which iojs:
which npm:
npm config get prefix: ${NVM_DIR}/sh: npm: not found
npm root -g: ${NVM_DIR}/sh: npm: not found
nvm ls
output:
N/A
iojs -> N/A (default)
node -> stable (-> N/A) (default)
unstable -> N/A (default)
How did you install nvm
?
I’m using this dockerfile:
FROM alpine:3.12.0
USER root
RUN apk update
RUN apk add -U curl bash ca-certificates openssl ncurses coreutils python2 make gcc g++ libgcc linux-headers grep util-linux binutils findutils
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
RUN . /root/.nvm/nvm.sh && nvm install --lts
What steps did you perform?
docker build .
What happened?
Step 6 (RUN . /root/.nvm/nvm.sh && nvm install --lts) throws error:
Step 5/6 : RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
---> Running in 3f21afe659ae
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 13527 100 13527 0 0 155k 0 --:--:-- --:--:-- --:--:-- 157k
=> Downloading nvm as script to '/root/.nvm'
=> Profile not found. Tried ~/.bashrc, ~/.bash_profile, ~/.zshrc, and ~/.profile.
=> Create one of them and run this script again
OR
=> Append the following lines to the correct file yourself:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
=> Close and reopen your terminal to start using nvm or run the following to use it now:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
Removing intermediate container 3f21afe659ae
---> 4ce12499c4d4
Step 6/6 : RUN . /root/.nvm/nvm.sh && nvm install --lts
---> Running in b5de68c43794
Installing latest LTS version.
Downloading and installing node v12.18.2...
Downloading https://nodejs.org/dist/v12.18.2/node-v12.18.2-linux-x64.tar.xz...
######################################################################## 100.0%
Computing checksum with sha256sum
Checksums matched!
env: ‘node’: No such file or directory
nvm is not compatible with the npm config "prefix" option: currently set to ""
Run `nvm use --delete-prefix v12.18.2` to unset it.
What did you expect to happen?
I expect to have nodejs v12.18.2 installed without error
Is there anything in any of your profile files that modifies the PATH
?
There are no profile files
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16 (6 by maintainers)
I’m not sure if this will work for all cases, but I installed gcompat (
RUN apk add gcompat
) and it worked. In my case this error only appeared when I triednpm install
. Here’s my dockerfile:I worked around my issue for the meantime by compiling from source (
nvm install -s v8.12.0
).