Operating system and version:
OS X latest, Ubuntu 16.04
nvm debug output:
nvm --version: v0.33.1
$SHELL: /bin/zsh
$HOME: /home/docwhat
$NVM_DIR: '$HOME/.nvm'
$PREFIX: ''
$NPM_CONFIG_PREFIX: ''
$NVM_NODEJS_ORG_MIRROR: 'https://nodejs.org/dist'
$NVM_IOJS_ORG_MIRROR: 'https://iojs.org/dist'
nvm current: none
which node: node not found
which iojs: iojs not found
which npm: npm not found
npm config get prefix: _zsh_nvm_nvm:109: command not found: npm
npm root -g: _zsh_nvm_nvm:109: command not found: npm
nvm ls output:
nvm ls
N/A
node -> stable (-> N/A) (default)
iojs -> N/A (default)
lts/* -> lts/boron (-> N/A)
lts/argon -> v4.8.2 (-> N/A)
lts/boron -> v6.10.2 (-> N/A)
How did you install nvm? (e.g. install script in readme, homebrew):
zgen load lukechilds/zsh-nvm
What steps did you perform?
$ nvm install node
What happened?
$ nvm install node
Downloading and installing node v7.8.0...
Downloading https://nodejs.org/dist/v7.8.0/node-v7.8.0-linux-x64.tar.xz...
######################################################################## 100.0%
Computing checksum with sha256sum
Checksums do not match: 'a787603d24847638636033047c6ab4789291c7175a8355b3d1de1bc82fd2b0a3' found, '1fca4e71d6f00f7f727994fccc604716160f06aa1ad6d8689d84cd3ca5227312' expected.
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.8.0/node-v7.8.0.tar.xz...
######################################################################## 100.0%
Computing checksum with sha256sum
Checksums do not match: '6776c3b22a119b521adf2ba3bc0e0e9e29012b7e3d95561c4a03f83724ae1a7a' found, '6821aaee58bbc8bc8d08fec6989a42278b725a21382500dc20fd9d9f71398f02' expected.
xz: (stdin): File format not recognized
tar: Child returned status 1
tar: Error is not recoverable: exiting now
nvm: install v7.8.0 failed!
What did you expect to happen?
I expected it to notice that the HTTP code from nodejs.org was 522 and not even bother with the checksum check and return a better error message.
I understand that nodejs.org is having issues right now which is why I'm getting 522. I just thought that nvm should handle it all better.
The output of several curl attempts:
$ curl -v -I https://nodejs.org/dist/v7.8.0/node-v7.8.0-linux-x64.tar.xz
* Trying 2400:cb00:2048:1::6814:162e...
* Connected to nodejs.org (2400:cb00:2048:1::6814:162e) port 443 (#0)
* found 173 certificates in /etc/ssl/certs/ca-certificates.crt
* found 699 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* SSL connection using TLS1.2 / ECDHE_RSA_AES_128_GCM_SHA256
* server certificate verification OK
* server certificate status verification SKIPPED
* common name: *.nodejs.org (matched)
* server certificate expiration date OK
* server certificate activation date OK
* certificate public key: RSA
* certificate version: #3
* subject: OU=Domain Control Validated,OU=PositiveSSL Wildcard,CN=*.nodejs.org
* start date: Sun, 08 Nov 2015 00:00:00 GMT
* expire date: Tue, 22 Aug 2017 23:59:59 GMT
* issuer: C=GB,ST=Greater Manchester,L=Salford,O=COMODO CA Limited,CN=COMODO RSA Domain Validation Secure Server CA
* compression: NULL
* ALPN, server accepted to use http/1.1
> HEAD /dist/v7.8.0/node-v7.8.0-linux-x64.tar.xz HTTP/1.1
> Host: nodejs.org
> User-Agent: curl/7.47.0
> Accept: */*
>
< HTTP/1.1 522 Origin Connection Time-out
HTTP/1.1 522 Origin Connection Time-out
< Date: Tue, 04 Apr 2017 22:48:53 GMT
Date: Tue, 04 Apr 2017 22:48:53 GMT
< Content-Type: text/html; charset=UTF-8
Content-Type: text/html; charset=UTF-8
< Connection: keep-alive
Connection: keep-alive
< Set-Cookie: __cfduid=dde4efe982214e8a0cb8594cb70a9b4d01491346028; expires=Wed, 04-Apr-18 22:47:08 GMT; path=/; domain=.nodejs.org; HttpOnly
Set-Cookie: __cfduid=dde4efe982214e8a0cb8594cb70a9b4d01491346028; expires=Wed, 04-Apr-18 22:47:08 GMT; path=/; domain=.nodejs.org; HttpOnly
< Expires: Thu, 01 Jan 1970 00:00:01 GMT
Expires: Thu, 01 Jan 1970 00:00:01 GMT
< Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
< Pragma: no-cache
Pragma: no-cache
< X-Frame-Options: SAMEORIGIN
X-Frame-Options: SAMEORIGIN
< Server: cloudflare-nginx
Server: cloudflare-nginx
< CF-RAY: 34a7cec6dd9521d4-EWR
CF-RAY: 34a7cec6dd9521d4-EWR
<
* Connection #0 to host nodejs.org left intact
$ curl -v -4 -I https://nodejs.org/dist/v7.8.0/node-v7.8.0-linux-x64.tar.xz
* Trying 104.20.23.46...
* Connected to nodejs.org (104.20.23.46) port 443 (#0)
* found 173 certificates in /etc/ssl/certs/ca-certificates.crt
* found 699 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* SSL connection using TLS1.2 / ECDHE_RSA_AES_128_GCM_SHA256
* server certificate verification OK
* server certificate status verification SKIPPED
* common name: *.nodejs.org (matched)
* server certificate expiration date OK
* server certificate activation date OK
* certificate public key: RSA
* certificate version: #3
* subject: OU=Domain Control Validated,OU=PositiveSSL Wildcard,CN=*.nodejs.org
* start date: Sun, 08 Nov 2015 00:00:00 GMT
* expire date: Tue, 22 Aug 2017 23:59:59 GMT
* issuer: C=GB,ST=Greater Manchester,L=Salford,O=COMODO CA Limited,CN=COMODO RSA Domain Validation Secure Server CA
* compression: NULL
* ALPN, server accepted to use http/1.1
> HEAD /dist/v7.8.0/node-v7.8.0-linux-x64.tar.xz HTTP/1.1
> Host: nodejs.org
> User-Agent: curl/7.47.0
> Accept: */*
>
< HTTP/1.1 522 Origin Connection Time-out
HTTP/1.1 522 Origin Connection Time-out
< Date: Tue, 04 Apr 2017 22:49:34 GMT
Date: Tue, 04 Apr 2017 22:49:34 GMT
< Content-Type: text/html; charset=UTF-8
Content-Type: text/html; charset=UTF-8
< Connection: keep-alive
Connection: keep-alive
< Set-Cookie: __cfduid=d0579527c0bd28fb87196985d5b65badb1491346144; expires=Wed, 04-Apr-18 22:49:04 GMT; path=/; domain=.nodejs.org; HttpOnly
Set-Cookie: __cfduid=d0579527c0bd28fb87196985d5b65badb1491346144; expires=Wed, 04-Apr-18 22:49:04 GMT; path=/; domain=.nodejs.org; HttpOnly
< Expires: Thu, 01 Jan 1970 00:00:01 GMT
Expires: Thu, 01 Jan 1970 00:00:01 GMT
< Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
< Pragma: no-cache
Pragma: no-cache
< X-Frame-Options: SAMEORIGIN
X-Frame-Options: SAMEORIGIN
< Server: cloudflare-nginx
Server: cloudflare-nginx
< CF-RAY: 34a7d19c0858473a-EWR
CF-RAY: 34a7d19c0858473a-EWR
<
* Connection #0 to host nodejs.org left intact
Is there anything in any of your profile files (.bashrc, .bash_profile, .zshrc, etc) that modifies the PATH?
Tons, see https://github.com/docwhat/dotfiles for my whole setup.
curl -I --compressed -v https://nodejs.org/dist/ print out?```sh
$ curl -I --compressed -v https://nodejs.org/dist/
* Trying 2400:cb00:2048:1::6814:172e...
* Connected to nodejs.org (2400:cb00:2048:1::6814:172e) port 443 (#0)
* found 173 certificates in /etc/ssl/certs/ca-certificates.crt
* found 699 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* SSL connection using TLS1.2 / ECDHE_RSA_AES_128_GCM_SHA256
* server certificate verification OK
* server certificate status verification SKIPPED
* common name: *.nodejs.org (matched)
* server certificate expiration date OK
* server certificate activation date OK
* certificate public key: RSA
* certificate version: #3
* subject: OU=Domain Control Validated,OU=PositiveSSL Wildcard,CN=*.nodejs.org
* start date: Sun, 08 Nov 2015 00:00:00 GMT
* expire date: Tue, 22 Aug 2017 23:59:59 GMT
* issuer: C=GB,ST=Greater Manchester,L=Salford,O=COMODO CA Limited,CN=COMODO RSA Domain Validation Secure Server CA
* compression: NULL
* ALPN, server accepted to use http/1.1
> HEAD /dist/ HTTP/1.1
> Host: nodejs.org
> User-Agent: curl/7.47.0
> Accept: */*
> Accept-Encoding: deflate, gzip
>
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Date: Tue, 04 Apr 2017 23:00:13 GMT
Date: Tue, 04 Apr 2017 23:00:13 GMT
< Content-Type: text/html
Content-Type: text/html
< Connection: keep-alive
Connection: keep-alive
< Set-Cookie: __cfduid=db500eaf269a21c73b4ca4ec3f153ac021491346798; expires=Wed, 04-Apr-18 22:59:58 GMT; path=/; domain=.nodejs.org; HttpOnly
Set-Cookie: __cfduid=db500eaf269a21c73b4ca4ec3f153ac021491346798; expires=Wed, 04-Apr-18 22:59:58 GMT; path=/; domain=.nodejs.org; HttpOnly
< CF-Cache-Status: STALE
CF-Cache-Status: STALE
< Vary: Accept-Encoding
Vary: Accept-Encoding
< Expires: Wed, 05 Apr 2017 03:00:13 GMT
Expires: Wed, 05 Apr 2017 03:00:13 GMT
< Cache-Control: public, max-age=14400
Cache-Control: public, max-age=14400
< Server: cloudflare-nginx
Server: cloudflare-nginx
< CF-RAY: 34a7e1944fe01834-EWR
CF-RAY: 34a7e1944fe01834-EWR
< Content-Encoding: gzip
Content-Encoding: gzip
<
* Connection #0 to host nodejs.org left intact
```
</details>
Just ran into this as well. node-v6.10.0-linux-x64.tar.xz contained the HTML error page served by cloudflare!
Manually downloading from https://npm.taobao.org/mirrors/node/ seems to have done the trick
Indeed, nodejs.org is having issues; nvm doesn't check http codes (which is a bit more complex to do in posix with curl when you normally just want the output), it just tries to extract what it gets.
I'll leave this open, but I don't anticipate being able to fix it any time soon; this happens like 2 or 3 times a year tops.
This can be handled in curl via the --fail flag:
-f,--fail(HTTP) Fail silently (no output at all) on server errors. This is mostly done to better enable scripts etc to better deal with failed attempts. In normal cases when an HTTP server fails to deliver a document, it returns an HTML document stating so (which often also describes why and more). This flag will prevent curl from outputting that and return error 22.
This method is not fail-safe and there are occasions where non-successful response codes will slip through, especially when authentication is involved (response codes 401 and 407).
Thanks, that's good to know. That seems simpler to add to install, altho i'd prefer not to add it to ls-remote :-)
FYI: You can also figure out _why_ curl failed via the exit codes... it has a long list in the man page.
Most helpful comment
Thanks, that's good to know. That seems simpler to add to
install, altho i'd prefer not to add it tols-remote:-)