Repository: nvm-sh/nvm

Issue #1563: Can't run `npm run test/fast` locally
Created: 2017-06-23T05:17:34Z
Since 7f3145b, there is a new unit test called nvm_default_packages that I can never pass, both on Ubuntu and Mac
Error message:
    ✗ nvm_default_packages
touch: cannot touch '/default-packages': Permission denied
./nvm_default_packages: line 26: /default-packages: Permission denied
Downloading and installing node v6.10.1...
Downloading https://nodejs.org/dist/v6.10.1/node-v6.10.1-linux-x64.tar.xz...
######################################################################## 100.0%
Computing checksum with sha256sum
Checksums matched!
nvm is not compatible with the npm config "prefix" option: currently set to "/usr/local"
Run `npm config delete prefix` or `nvm use --delete-prefix v6.10.1` to unset it.
expected 'nvm install v6.10.1' to exit with 0, got 11

✗ nvm_default_packages
touch: /default-packages: Permission denied
./nvm_default_packages: line 26: /default-packages: Permission denied
Downloading and installing node v6.10.1...
Downloading https://nodejs.org/dist/v6.10.1/node-v6.10.1-darwin-x64.tar.xz...
######################################################################## 100.0%
Computing checksum with shasum -a 256
Checksums matched!
npm WARN invalid config loglevel="notice"
Now using node v6.10.1 (npm v3.10.10)
Creating default alias: default -> v6.10.1
npm WARN invalid config loglevel="notice"
npm WARN invalid config loglevel="notice"
npm WARN invalid config loglevel="notice"
touch: /default-packages: Permission denied
N/A: version "N/A -> N/A" is not yet installed.

You need to run "nvm install N/A" to install it before using it.
./nvm_default_packages: line 50: /default-packages: Permission denied
Downloading and installing node v6.10.1...
Local cache found: $NVM_DIR/.cache/bin/node-v6.10.1-darwin-x64/node-v6.10.1-darwin-x64.tar.xz
Checksums match! Using existing downloaded archive $NVM_DIR/.cache/bin/node-v6.10.1-darwin-x64/node-v6.10.1-darwin-x64.tar.xz
npm WARN invalid config loglevel="notice"
npm WARN invalid config loglevel="notice"
npm WARN invalid config loglevel="notice"
touch: /default-packages: Permission denied
./nvm_default_packages: line 71: /default-packages: Permission denied
Downloading and installing node v6.10.1...
Local cache found: $NVM_DIR/.cache/bin/node-v6.10.1-darwin-x64/node-v6.10.1-darwin-x64.tar.xz
Checksums match! Using existing downloaded archive $NVM_DIR/.cache/bin/node-v6.10.1-darwin-x64/node-v6.10.1-darwin-x64.tar.xz
npm WARN invalid config loglevel="notice"
npm WARN invalid config loglevel="notice"
npm WARN invalid config loglevel="notice"
touch: /default-packages: Permission denied
./nvm_default_packages: line 87: /default-packages: Permission denied
Downloading and installing node v6.10.1...
Local cache found: $NVM_DIR/.cache/bin/node-v6.10.1-darwin-x64/node-v6.10.1-darwin-x64.tar.xz
Checksums match! Using existing downloaded archive $NVM_DIR/.cache/bin/node-v6.10.1-darwin-x64/node-v6.10.1-darwin-x64.tar.xz
expected 'nvm install v6.10.1' to exit with 1, got 0

touch: cannot touch '/default-packages': Permission denied
./nvm_default_packages: line 26: /default-packages: Permission denied
Downloading and installing node v6.10.1...
Downloading https://nodejs.org/dist/v6.10.1/node-v6.10.1-linux-x64.tar.xz...
######################################################################## 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v6.10.1 (npm v3.10.10)
Creating default alias: default -> v6.10.1
touch: cannot touch '/default-packages': Permission denied
N/A: version "N/A -> N/A" is not yet installed.

You need to run "nvm install N/A" to install it before using it.
./nvm_default_packages: line 50: /default-packages: Permission denied
Downloading and installing node v6.10.1...
Local cache found: $NVM_DIR/.cache/bin/node-v6.10.1-linux-x64/node-v6.10.1-linux-x64.tar.xz
Checksums match! Using existing downloaded archive $NVM_DIR/.cache/bin/node-v6.10.1-linux-x64/node-v6.10.1-linux-x64.tar.xz
touch: cannot touch '/default-packages': Permission denied
./nvm_default_packages: line 71: /default-packages: Permission denied
Downloading and installing node v6.10.1...
Local cache found: $NVM_DIR/.cache/bin/node-v6.10.1-linux-x64/node-v6.10.1-linux-x64.tar.xz
Checksums match! Using existing downloaded archive $NVM_DIR/.cache/bin/node-v6.10.1-linux-x64/node-v6.10.1-linux-x64.tar.xz
touch: cannot touch '/default-packages': Permission denied
./nvm_default_packages: line 87: /default-packages: Permission denied
Downloading and installing node v6.10.1...
Local cache found: $NVM_DIR/.cache/bin/node-v6.10.1-linux-x64/node-v6.10.1-linux-x64.tar.xz
Checksums match! Using existing downloaded archive $NVM_DIR/.cache/bin/node-v6.10.1-linux-x64/node-v6.10.1-linux-x64.tar.xz
expected 'nvm install v6.10.1' to exit with 1, got 0

    ✗ nvm_default_packages
touch: cannot touch '/default-packages': Permission denied
./nvm_default_packages: line 26: /default-packages: Permission denied
Downloading and installing node v6.10.1...
Downloading https://nodejs.org/dist/v6.10.1/node-v6.10.1-linux-x64.tar.xz...
######################################################################## 100.0%
Computing checksum with sha256sum
Checksums matched!
npm WARN invalid config loglevel="notice"
Now using node v6.10.1 (npm v3.10.10)
Creating default alias: default -> v6.10.1
npm WARN invalid config loglevel="notice"
npm WARN invalid config loglevel="notice"
npm WARN invalid config loglevel="notice"
touch: cannot touch '/default-packages': Permission denied
N/A: version "N/A -> N/A" is not yet installed.

You need to run "nvm install N/A" to install it before using it.
./nvm_default_packages: line 50: /default-packages: Permission denied
Downloading and installing node v6.10.1...
Local cache found: $NVM_DIR/.cache/bin/node-v6.10.1-linux-x64/node-v6.10.1-linux-x64.tar.xz
Checksums match! Using existing downloaded archive $NVM_DIR/.cache/bin/node-v6.10.1-linux-x64/node-v6.10.1-linux-x64.tar.xz
npm WARN invalid config loglevel="notice"
npm WARN invalid config loglevel="notice"
npm WARN invalid config loglevel="notice"
touch: cannot touch '/default-packages': Permission denied
./nvm_default_packages: line 71: /default-packages: Permission denied
Downloading and installing node v6.10.1...
Local cache found: $NVM_DIR/.cache/bin/node-v6.10.1-linux-x64/node-v6.10.1-linux-x64.tar.xz
Checksums match! Using existing downloaded archive $NVM_DIR/.cache/bin/node-v6.10.1-linux-x64/node-v6.10.1-linux-x64.tar.xz
npm WARN invalid config loglevel="notice"
npm WARN invalid config loglevel="notice"
npm WARN invalid config loglevel="notice"
touch: cannot touch '/default-packages': Permission denied
./nvm_default_packages: line 87: /default-packages: Permission denied
Downloading and installing node v6.10.1...
Local cache found: $NVM_DIR/.cache/bin/node-v6.10.1-linux-x64/node-v6.10.1-linux-x64.tar.xz
Checksums match! Using existing downloaded archive $NVM_DIR/.cache/bin/node-v6.10.1-linux-x64/node-v6.10.1-linux-x64.tar.xz
expected 'nvm install v6.10.1' to exit with 1, got 0

Duplicate issue #2179: Tests failing with shipped docker file
Created: 2020-03-15T17:45:13Z
Operating system and version:
Mac OS X 10.15.3
git version 2.25.1
Client: Docker Engine - Community, Version:           19.03.8
Server: Docker Engine - Community, Engine: Version:          19.03.8
What steps did you perform?
$ git clone...
(master -> commit f607f2)
$ cd...
$ docker build -t nvm-dev .
(this took about 2 minutes btw, not 8)
$ docker run -h nvm-dev -it nvm-dev
(now inside docker)
nvm@nvm-dev:~/.nvm$ npm run test/fast
What happened?
A lot of errors about permissions denied, e.g.
+ mkdir src alias
    Aliases
./setup: 28: cd: can't cd to /home/nvm/.nvm/versions/node/v13.11.0/bin
mkdir: cannot create directory '/v0.0.1': Permission denied
unable to make bin dir
mkdir: cannot create directory '/v0.1.1': Permission denied
unable to make bin dir
mkdir: cannot create directory '/versions': Permission denied
unable to make bin dir

12 tests failing in total, e.g.
    ✗ nvm_command_info /usr/bin/env: node: No such file or directory wget command info wrong(stage 1), expected: '', got '/usr/bin/wget' ./nvm_command_info: line 4: unalias: wget: not found
   ✗ nvm_die_on_prefix 'NPM_CONFIG_PREFIX=bar nvm_die_on_prefix 0 foo' did not error with 'nvm is not compatible with the "NPM_CONFIG_PREFIX" environment variable: currently set to "bar" Rununset NPM_CONFIG_PREFIX to unset it.'; got ''
What did you expect to happen?
All tests to pass. Possibly no errors while running them.

Closing comment (2020-03-30T03:54:54Z): wget is installed (https://github.com/nvm-sh/nvm/blob/master/Dockerfile#L48), and I'll expect all the tests would be tested inside a Docker container, as I assume there is no dependencies on hardware or physical environments, but I think the test issue is the same as #1563