See https://github.com/travis-ci/travis-ci/issues/7001#issuecomment-266052423 for context.
Currently, when nvm install fails, it exits with status 0. This is not optimal for use in scripts where various error recovery should be tried after this failure.
$ nvm install 4
VERSION_PATH=''
# 1.8%
curl: (56) SSLRead() return error -9806
Binary download from https://nodejs.org/dist/v4.7.0/node-v4.7.0-darwin-x64.tar.xz failed, trying source.
grep: /Users/asari/.nvm/.cache/bin/node-v4.7.0-darwin-x64/node-v4.7.0-darwin-x64.tar.xz: No such file or directory
Provided file to checksum does not exist.
Binary download failed, trying source.
Detected that you have 4 CPU thread(s)
Set the number of jobs to 4 - 1 = 3 jobs to speed up the build
######################################################################## 100.0%
Computing checksum with shasum -a 256
Checksums do not match: '069d5ee4f79eace011758601f9c048f5c22b9673759beaf31308c43842f4f838' found, 'b03c777ba8817a8478d57f00797db86dc7e7953d2066c34edbceeba8ad056142' expected.
tar: Unrecognized archive format
tar: Error exit delayed from previous errors.
nvm: install v4.7.0 failed!
$ echo $?
0
If breaking the changes is a concern, perhaps we can add a new flag to the commands so that certain failures can cause non-zero exit status. (For example, curl would do this if you add -f; otherwise it always exits with 0.)
Nope, this is a bug that needs to be fixed.
@ljharb did you see https://github.com/creationix/nvm/pull/1348?
@Turbo87 yes, but sometimes people are busy on weekends
sure, no problem, just wanted to make sure it wasn't overlooked :)
Fix is merged; I'll plan to cut a release this weekend.
I don't suppose you might be able to release this soon?
nodejs.org is experiencing issues again (nodejs/nodejs.org#1191) and the incorrect exit code from nvm made the root cause harder to identify in our Travis CI runs (since it's in a collapsed section higher in the log).
Thanks for the report @edmorley,
I just got an issue few minutes ago on my travis build

also I got this in my local
$ nvm install --lts=boron
Installing with latest version of LTS line: boron
Downloading and installing node v6.10.2...
Local cache found: $NVM_DIR/.cache/bin/node-v6.10.2-linux-x64/node-v6.10.2-linux-x64.tar.xz
Computing checksum with sha256sum
Checksums do not match: '5124e2795f221508a4000d8c6c0ff5cf978480c5cbff8c9ff69caae9e8c06a1c' found, 'b519cd616b0671ab789d2645c5c026deb7e016d73a867ab4b1b8c9ceba9c3503' expected.
Checksum check failed!
Removing the broken local cache...
Downloading https://nodejs.org/dist/v6.10.2/node-v6.10.2-linux-x64.tar.xz...
######################################################################## 100.0%
Computing checksum with sha256sum
Checksums do not match: '21710d0294b2ac034d4452b3be6ba556ceab6bb13ad812c4ff3db49d167b6954' found, 'b519cd616b0671ab789d2645c5c026deb7e016d73a867ab4b1b8c9ceba9c3503' expected.
xz: (stdin): File format not recognized
tar: Child returned status 1
tar: Error is not recoverable: exiting now
Binary download failed, trying source.
Local cache found: $NVM_DIR/.cache/src/node-v6.10.2/node-v6.10.2.tar.xz
Computing checksum with sha256sum
Checksums do not match: '5606211d79c42b667108022e0fcc3f0d7b1fd1f14c0a8022dd49fe1955b0ceec' found, '80aa11333da99813973a99646e2113c6be5b63f665c0731ed14ecb94cbe846b6' expected.
Checksum check failed!
Removing the broken local cache...
Downloading https://nodejs.org/dist/v6.10.2/node-v6.10.2.tar.xz...
######################################################################## 100.0%
Computing checksum with sha256sum
Checksums do not match: 'f38c8f8bbe5601c1b6901207b5e57bf3a5dc0c7aa78055ec6b4f52927620e1d5' found, '80aa11333da99813973a99646e2113c6be5b63f665c0731ed14ecb94cbe846b6' expected.
xz: (stdin): File format not recognized
tar: Child returned status 1
tar: Error is not recoverable: exiting now
nvm: install v6.10.2 failed!
Got it too on my local
`Downloading and installing node v7.7.0...
Downloading https://nodejs.org/dist/v7.7.0/node-v7.7.0-linux-x64.tar.xz...
######################################################################## 100.0%
Computing checksum with sha256sum
Provided checksum to compare to is empty.
xz: (stdin): File format not recognized
tar: Child returned status 1
tar: Error is not recoverable: exiting now
Binary download failed, trying source.
Detected that you have 4 CPU core(s)
Running with 3 threads to speed up the build
Downloading https://nodejs.org/dist/v7.7.0/node-v7.7.0.tar.xz...
######################################################################## 100.0%
Computing checksum with sha256sum
Provided checksum to compare to is empty.
xz: (stdin): File format not recognized
tar: Child returned status 1
tar: Error is not recoverable: exiting now
nvm: install v7.7.0 failed!
There's no need for more +1s. This issue is known, fixed on master and just needs a new release.
You're probably instead looking for nodejs/nodejs.org#1191 (but similarly, please no +1s there either to avoid spamming everyone).
Also, #1482 might be useful.
Most helpful comment
I don't suppose you might be able to release this soon?
nodejs.org is experiencing issues again (nodejs/nodejs.org#1191) and the incorrect exit code from nvm made the root cause harder to identify in our Travis CI runs (since it's in a collapsed section higher in the log).