Open sjoudry opened 1 year ago
I would expect that to work as well. (Note that there is an nvm dockerfile you could try as well)
What's the ownership of $HOME
and $NVM_DIR
look like?
The directories are both owned by root:
# ls -al /
total 72
drwxr-xr-x 1 root root 4096 Oct 20 17:00 ./
drwxr-xr-x 1 root root 4096 Oct 20 17:00 ../
-rwxr-xr-x 1 root root 0 Oct 20 17:00 .dockerenv*
drwxr-xr-x 8 root root 256 Oct 20 09:50 app/
lrwxrwxrwx 1 root root 7 Sep 22 12:47 bin -> usr/bin/
drwxr-xr-x 2 root root 4096 Apr 15 2020 boot/
drwxr-xr-x 5 root root 340 Oct 21 09:20 dev/
drwxr-xr-x 1 root root 4096 Oct 20 17:00 etc/
drwxr-xr-x 2 root root 4096 Apr 15 2020 home/
lrwxrwxrwx 1 root root 7 Sep 22 12:47 lib -> usr/lib/
lrwxrwxrwx 1 root root 9 Sep 22 12:47 lib32 -> usr/lib32/
lrwxrwxrwx 1 root root 9 Sep 22 12:47 lib64 -> usr/lib64/
lrwxrwxrwx 1 root root 10 Sep 22 12:47 libx32 -> usr/libx32/
drwxr-xr-x 2 root root 4096 Sep 22 12:47 media/
drwxr-xr-x 2 root root 4096 Sep 22 12:47 mnt/
drwxr-xr-x 2 root root 4096 Sep 22 12:47 opt/
dr-xr-xr-x 212 root root 0 Oct 21 09:20 proc/
drwx------ 1 root root 4096 Oct 20 17:23 root/
drwxr-xr-x 1 root root 4096 Oct 20 09:32 run/
lrwxrwxrwx 1 root root 8 Sep 22 12:47 sbin -> usr/sbin/
drwxr-xr-x 2 root root 4096 Sep 22 12:47 srv/
drwxr-xr-x 11 root root 352 Oct 14 10:20 ssl/
dr-xr-xr-x 13 root root 0 Oct 21 09:20 sys/
drwxrwxrwt 1 root root 4096 Oct 20 17:21 tmp/
drwxr-xr-x 1 root root 4096 Oct 20 09:32 usr/
drwxr-xr-x 1 root root 4096 Sep 22 12:50 var/
# ls -al /root
total 44
drwx------ 1 root root 4096 Oct 20 17:23 ./
drwxr-xr-x 1 root root 4096 Oct 20 17:00 ../
-rw-r--r-- 1 root root 3303 Oct 20 09:32 .bashrc
-rw------- 1 root root 0 Oct 20 17:23 .node_repl_history
drwxr-xr-x 4 root root 4096 Oct 20 17:11 .npm/
drwxr-xr-x 8 root root 4096 Oct 20 17:11 .nvm/
-rw-r--r-- 1 root root 161 Dec 5 2019 .profile
-rw------- 1 root root 8708 Oct 20 17:23 .viminfo
-rw-r--r-- 1 root root 241 Oct 20 17:21 .wget-hsts
I encount same issue, too. And ownership is also the same.
Same here. Really weird.
Operating system and version:
Running in docker - Ubuntu 20.04. I've added the Dockerfile and docker-compose.yml file at the end of the issue summary.
nvm debug
output:nvm ls
output:How did you install
nvm
?What steps did you perform?
I have a docker container running Ubuntu 20.04 and nvm (using the command above). I have started with a blank slate and ran these commands:
And then inside the container (I have an .nvmrc file with v16.18.0 as the version):
What happened?
The npm install failed:
What did you expect to happen?
I expected the gatsby-cli module and all dependencies to be installed successfully.
Is there anything in any of your profile files that modifies the
PATH
?No.
Docker information
The contents of my Dockerfile:
The contents of my docker-compose.yml file:
Workaround/Root Cause
When nvm installs node, the permissions are maintained from the tarball and this is causing the problem:
Running chown before npm install fixes the issue:
However, since nvm is managing node, it should also be managing the permissions.