Skip to content

Instantly share code, notes, and snippets.

@garthk
Last active September 10, 2015 08:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garthk/510e93affdd213768c93 to your computer and use it in GitHub Desktop.
Save garthk/510e93affdd213768c93 to your computer and use it in GitHub Desktop.
nodejs.org/dist CDN for HTTP misconfigured to redirect to the blog
[ec2-user@hostname tmp]$ sudo rm -rf node_modules/
[ec2-user@hostname tmp]$ npm install sleep
/
> sleep@3.0.0 install /tmp/node_modules/sleep
> node-gyp rebuild
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: incorrect header check
gyp ERR! stack at Zlib._binding.onerror (zlib.js:295:17)
gyp ERR! System Linux 2.6.32-504.el6.x86_64
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /tmp/node_modules/sleep
gyp ERR! node -v v0.10.32
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok
npm ERR! sleep@3.0.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sleep@3.0.0 install script.
npm ERR! This is most likely a problem with the sleep package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls sleep
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 2.6.32-504.el6.x86_64
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "sleep"
npm ERR! cwd /tmp
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0
[ec2-user@hostname tmp]$
(reverse-i-search)`pack': cd ^Cckage/
[ec2-user@hostname tmp]$
[ec2-user@hostname tmp]$ tar xvfz ~/.npm/sleep/3.0.0/package.tgz
package/package.json
package/.npmignore
package/README.md
package/index.js
package/test.js
package/LICENSE.txt
package/binding.gyp
package/sleep.cc
[ec2-user@hostname tmp]$ cd p
-bash: cd: p: No such file or directory
[ec2-user@hostname tmp]$ cd package/
[ec2-user@hostname package]$ npm install
> sleep@3.0.0 install /tmp/package
> node-gyp rebuild
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: incorrect header check
gyp ERR! stack at Zlib._binding.onerror (zlib.js:295:17)
gyp ERR! System Linux 2.6.32-504.el6.x86_64
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /tmp/package
gyp ERR! node -v v0.10.32
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok
npm ERR! sleep@3.0.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sleep@3.0.0 install script.
npm ERR! This is most likely a problem with the sleep package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls sleep
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 2.6.32-504.el6.x86_64
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! cwd /tmp/package
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /tmp/package/npm-debug.log
npm ERR! not ok code 0
[ec2-user@hostname package]$ node-gyp
Usage: node-gyp <command> [options]
where <command> is one of:
- build - Invokes `make` and builds the module
- clean - Removes any generated build files and the "out" dir
- configure - Generates a Makefile for the current module
- rebuild - Runs "clean", "configure" and "build" all at once
- install - Install node development files for the specified node version.
- list - Prints a listing of the currently installed node development files
- remove - Removes the node development files for the specified version
node-gyp@3.0.1 /usr/local/lib/node_modules/node-gyp
node@0.10.32
[ec2-user@hostname package]$ node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@1.0.1
gyp info using node@0.10.32 | linux | x64
gyp http GET http://nodejs.org/dist/v0.10.32/node-v0.10.32.tar.gz
gyp http 200 http://nodejs.org/dist/v0.10.32/node-v0.10.32.tar.gz
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: incorrect header check
gyp ERR! stack at Zlib._binding.onerror (zlib.js:295:17)
gyp ERR! System Linux 2.6.32-504.el6.x86_64
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /tmp/package
gyp ERR! node -v v0.10.32
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok
[ec2-user@hostname package]$ curl -D - -OL http://nodejs.org/dist/v0.10.32/node-v0.10.32.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0HTTP/1.1 301 Moved Permanently
Date: Thu, 10 Sep 2015 05:47:07 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
Set-Cookie: __cfduid=df56fbaba4359107e377b536a4d7f50a81441864026; expires=Fri, 09-Sep-16 05:47:06 GMT; path=/; domain=.nodejs.org; HttpOnly
Location: https://nodejs.org/en/blog/
Server: cloudflare-nginx
CF-RAY: 2238d6170bf50b14-SYD
193 193 0 193 0 0 404 0 --:--:-- --:--:-- --:--:-- 413HTTP/1.1 200 OK
Server: cloudflare-nginx
Date: Thu, 10 Sep 2015 05:47:07 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
Set-Cookie: __cfduid=d730d9c3bd8337b4fa1fc9de8ddabdb611441864027; expires=Fri, 09-Sep-16 05:47:07 GMT; path=/; domain=.nodejs.org; HttpOnly
Last-Modified: Wed, 09 Sep 2015 09:51:20 GMT
CF-Cache-Status: HIT
Expires: Thu, 10 Sep 2015 09:47:07 GMT
Cache-Control: public, max-age=14400
CF-RAY: 2238d61ab1d104c8-SYD
100 66931 0 66931 0 0 104k 0 --:--:-- --:--:-- --:--:-- 104k
[ec2-user@hostname package]$
[ec2-user@hostname package]$ ls -la
total 116
drwxrwxr-x. 3 ec2-user ec2-user 4096 Sep 10 01:47 .
drwxrwxrwt. 36 root root 4096 Sep 10 01:47 ..
-rw-rw-r--. 1 ec2-user ec2-user 175 Feb 7 2015 binding.gyp
-rw-rw-r--. 1 ec2-user ec2-user 449 Feb 7 2015 index.js
-rw-rw-r--. 1 ec2-user ec2-user 1082 Jun 3 04:02 LICENSE.txt
drwxrwxr-x. 3 ec2-user ec2-user 4096 Sep 10 01:34 node_modules
-rw-rw-r--. 1 ec2-user ec2-user 66931 Sep 10 01:47 node-v0.10.32.tar.gz
-rw-rw-r--. 1 ec2-user ec2-user 1473 Sep 10 01:45 npm-debug.log
-rw-rw-r--. 1 ec2-user ec2-user 19 Feb 7 2015 .npmignore
-rw-rw-r--. 1 ec2-user ec2-user 516 Jul 31 13:53 package.json
-rw-rw-r--. 1 ec2-user ec2-user 311 Jun 3 04:02 README.md
-rw-rw-r--. 1 ec2-user ec2-user 1395 Jul 31 14:13 sleep.cc
-rw-rw-r--. 1 ec2-user ec2-user 217 Feb 7 2015 test.js
[ec2-user@hostname package]$ tar tfz node-v0.10.32.tar.gz
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
[ec2-user@hostname package]$ head node-v0.10.32.tar.gz
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Node.js</title>
<link rel="dns-prefetch" href="http://fonts.googleapis.com">
<link rel="dns-prefetch" href="http://fonts.gstatic.com">
<link rel="dns-prefetch" href="http://www.google-analytics.com">
@garthk
Copy link
Author

garthk commented Sep 10, 2015

TL;DR: http://nodejs.org/dist/v0.10.32/node-v0.10.32.tar.gz is redirected to the Node blog:

$ curl -D - http://nodejs.org/dist/v0.10.32/node-v0.10.32.tar.gz
HTTP/1.1 301 Moved Permanently
Date: Thu, 10 Sep 2015 05:55:07 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
Set-Cookie: __cfduid=d52ef44ee3478066d5e056f61636c2a651441864507; expires=Fri, 09-Sep-16 05:55:07 GMT; path=/; domain=.nodejs.org; HttpOnly
Location: https://nodejs.org/en/blog/
Server: cloudflare-nginx
CF-RAY: 2238e1d1a9de0d9d-SJC

<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.4.6 (Ubuntu)</center>
</body>
</html>

Confirmed from Digital Ocean west-coast USA and EC2 Sydney.

@garthk
Copy link
Author

garthk commented Sep 10, 2015

The https version of the URL works fine.

@garthk
Copy link
Author

garthk commented Sep 10, 2015

Workaround: upgrade npm to get an upgraded embedded node-gyp that defaults to HTTPS.

sudo npm install -g npm@^2.14.2

That's an extreme upgrade from 1.4.28; I haven't yet dug to discover which earlier npm releases take node-gyp 2.0.2 or better.

@garthk
Copy link
Author

garthk commented Sep 10, 2015

Also reported in IRC:

[17:10:51]  <gabrielschulhof>   Hey, all! Big problem: http://nodejs.org/dist/v0.12.7/node-v0.12.7.tar.gz redirects to https://nodejs.org/en/blog/, so it breaks my travis build: https://travis-ci.org/otcshare/iotivity-node/jobs/79606658#L4846

@garthk
Copy link
Author

garthk commented Sep 10, 2015

Any version of npm north of these will work:

  • 2.13.2
  • 2.14 and later
  • 3.1.3
  • 3.2 and later
$ curl https://registry.npmjs.org/npm -o npm.json
$ node
> var npm = require('./npm.json');
> for (var key in npm.versions) { if (npm.versions[key].dependencies['node-gyp'] === '~2.0.2') { console.log(key); } }
2.13.2
3.1.3
2.13.3
3.2.0
2.13.4
3.2.1
2.13.5
3.2.2
2.14.0
3.3.0
2.14.1
2.14.2
3.3.1
2.14.3
3.3.2

@garthk
Copy link
Author

garthk commented Sep 10, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment