You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having trouble using nvm in a Docker container. Every time I run nvm, it complains that the npm config prefix option is set. Deleting any npm prefix option doesn't help, and I'm 99.9% sure that I'm not setting it anywhere.
The problem seems to be that the actual path of the home directory (and thus .nvm directory) is /home.host/griscom, but there's a symlink from /home to /home.host, and the home directory is actually configured as /home (which is the value of $HOME). (Setting HOME to /home.host/griscom doesn't help.)
Operating system and version:
Ubuntu 18.04 under Docker version 18.09.0, build 4d60db4; hosted on macOS 10.13.6. nvm version 0.33.11 .
nvm debug output:
nvm --version: v0.33.11
$SHELL: /bin/sh
$SHLVL: 1
$HOME: /home/griscom
$NVM_DIR: '$HOME/.nvm'$PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/local/Library/Frameworks/Python.framework/Versions/3.4/bin:$HOME/bin
$PREFIX: ''$NPM_CONFIG_PREFIX: ''$NVM_NODEJS_ORG_MIRROR: ''$NVM_IOJS_ORG_MIRROR: ''
/bin/sh: 0: Illegal option --
shell version: ''
uname -a: 'Linux 4.9.125-linuxkit #1 SMP Fri Sep 7 08:20:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux'
OS version: Ubuntu 18.04.1 LTS
curl: /usr/bin/curl, curl 7.58.0 (x86_64-pc-linux-gnu) libcurl/7.58.0 OpenSSL/1.1.0g zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
wget: /usr/bin/wget, GNU Wget 1.19.4 built on linux-gnu.
git: /usr/bin/git, git version 2.17.1
grep: /bin/grep, grep (GNU grep) 3.1
awk: /usr/bin/awk, GNU Awk 4.1.4, API: 1.1 (GNU MPFR 4.0.1, GNU MP 6.1.2)
sed: /bin/sed, sed (GNU sed) 4.4
cut: /usr/bin/cut, cut (GNU coreutils) 8.28
basename: /usr/bin/basename, basename (GNU coreutils) 8.28
rm: /bin/rm, rm (GNU coreutils) 8.28
mkdir: /bin/mkdir, mkdir (GNU coreutils) 8.28
xargs: /usr/bin/xargs, xargs (GNU findutils) 4.7.0-git
nvm current: system
which node: /usr/bin/node
which iojs:
which npm:
npm config get prefix: bash: npm: command not found
npm root -g: bash: npm: command not found
nvm output the following error message and then failed:
nvm is not compatible with the npm config "prefix" option: currently set to "/home.host/griscom/.nvm/versions/node/v8.12.0"
Run `nvm use --delete-prefix v8.12.0` to unset it.
What did you expect to happen?
for "nvm use" to execute properly
Is there anything in any of your profile files (.bashrc, .bash_profile, .zshrc, etc) that modifies the PATH?
No.
The problem seems to be confusion between /home/griscom and /home.host/griscom. My Docker startup command is:
This maps my home directory to the Docker-internal directory /home.host/griscom. Then, inside Docker, /home is linked to /home.host.
Somehow, npm and nvm have different ideas of which is being used: /home.host or /home.
Below is some more info, all generated inside the Docker instance. The biggest key is that echo ~ yields /home/griscom, while npm config get prefix yields /home.host/griscom/.nvm/versions/node/v8.12.0, which has /home.host rather than /home.
griscom@dev-ubuntu-18 $ nvm exec 8.12.0 npm install --production
nvm is not compatible with the npm config "prefix" option: currently set to "/home.host/griscom/.nvm/versions/node/v8.12.0"
Run `nvm use --delete-prefix v8.12.0 --silent` to unset it.
Running node v8.12.0
nvm is not compatible with the npm config "prefix" option: currently set to "/home.host/griscom/.nvm/versions/node/v8.12.0"
Run `nvm use --delete-prefix v8.12.0` to unset it.
griscom@dev-ubuntu-18 $ echo$?
127
griscom@dev-ubuntu-18 $ echo$PATH
/home/griscom/.nvm/versions/node/v8.12.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/local/Library/Frameworks/Python.framework/Versions/3.4/bin:/home/griscom/bin
griscom@dev-ubuntu-18 $ echo~
/home/griscom
griscom@dev-ubuntu-18 $ npm config get prefix
/home.host/griscom/.nvm/versions/node/v8.12.0
griscom@dev-ubuntu-18 $ npm config delete prefix
griscom@dev-ubuntu-18 $ npm config get prefix
/home.host/griscom/.nvm/versions/node/v8.12.0
griscom@dev-ubuntu-18 $ ls -l /
total 72
drwxr-xr-x 1 root root 4096 Jan 4 17:57 bin/
drwxr-xr-x 2 root root 4096 Apr 24 2018 boot/
drwxr-xr-x 4 root root 4096 Jan 4 18:18 data/
drwxr-xr-x 5 root root 360 Jan 4 20:26 dev/
-rwxr-xr-x 1 root root 1880 Jan 4 18:18 docker-entrypoint.sh*
drwxr-xr-x 1 root root 4096 Jan 4 20:26 etc/
lrwxrwxrwx 1 root root 10 Jan 4 20:26 home -> /home.host/
drwxr-xr-x 3 root root 4096 Jan 4 20:26 home.host/
drwxr-xr-x 1 root root 4096 Jan 4 17:57 lib/
drwxr-xr-x 2 root root 4096 Dec 4 17:11 lib64/
drwxr-xr-x 2 root root 4096 Dec 4 17:11 media/
drwxr-xr-x 2 root root 4096 Dec 4 17:11 mnt/
drwxr-xr-x 2 root root 4096 Dec 4 17:11 opt/
dr-xr-xr-x 215 root root 0 Jan 4 20:26 proc/
drwx------ 2 root root 4096 Dec 4 17:12 root/
drwxr-xr-x 1 root root 4096 Dec 28 23:22 run/
drwxr-xr-x 1 root root 4096 Dec 28 23:22 sbin/
drwxr-xr-x 2 root root 4096 Dec 4 17:11 srv/
dr-xr-xr-x 13 root root 0 Jan 4 20:26 sys/
drwxrwxrwt 1 root root 4096 Jan 4 21:42 tmp/
drwxr-xr-x 1 root root 4096 Dec 4 17:11 usr/
drwxr-xr-x 1 root root 4096 Dec 4 17:12 var/
griscom@dev-ubuntu-18 $ df /home.host/
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 61252420 9157944 48953308 16% /home.host
griscom@dev-ubuntu-18 $ cat ~/.npmrc
init.author.name=Dan Griscom
[email protected]
init.author.url=http://suitable.com
//registry.npmjs.org/:_authToken=4e6a3c35-dfae-4293-9bdd-93099c4f8ae1
griscom@dev-ubuntu-18 $ echo$SHELL
/bin/sh
griscom@dev-ubuntu-18 $ nvm exec 8.12.0 npm install --production
nvm is not compatible with the npm config "prefix" option: currently set to "/home.host/griscom/.nvm/versions/node/v8.12.0"
Run `nvm use --delete-prefix v8.12.0 --silent` to unset it.
Running node v8.12.0
nvm is not compatible with the npm config "prefix" option: currently set to "/home.host/griscom/.nvm/versions/node/v8.12.0"
Run `nvm use --delete-prefix v8.12.0` to unset it.
griscom@dev-ubuntu-18 $
The text was updated successfully, but these errors were encountered:
Indeed, nvm simply doesn't support $HOME being a symlink. It should work as a hard link; but if your home dir is a symlink there's no way nvm can work :-/
I'm having trouble using
nvm
in a Docker container. Every time I runnvm
, it complains that thenpm
config prefix option is set. Deleting any npm prefix option doesn't help, and I'm 99.9% sure that I'm not setting it anywhere.The problem seems to be that the actual path of the home directory (and thus
.nvm
directory) is/home.host/griscom
, but there's a symlink from/home
to/home.host
, and the home directory is actually configured as/home
(which is the value of$HOME
). (SettingHOME
to/home.host/griscom
doesn't help.)Ubuntu 18.04 under Docker version 18.09.0, build 4d60db4; hosted on macOS 10.13.6. nvm version 0.33.11 .
nvm debug
output:nvm ls
output:nvm
? (e.g. install script in readme, Homebrew):curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
nvm output the following error message and then failed:
for "nvm use" to execute properly
.bashrc
,.bash_profile
,.zshrc
, etc) that modifies thePATH
?No.
The problem seems to be confusion between /home/griscom and /home.host/griscom. My Docker startup command is:
This maps my home directory to the Docker-internal directory
/home.host/griscom
. Then, inside Docker,/home
is linked to/home.host
.Somehow,
npm
andnvm
have different ideas of which is being used:/home.host
or/home
.Below is some more info, all generated inside the Docker instance. The biggest key is that
echo ~
yields/home/griscom
, whilenpm config get prefix
yields/home.host/griscom/.nvm/versions/node/v8.12.0
, which has/home.host
rather than/home
.The text was updated successfully, but these errors were encountered: