node-gyp: node-gyp rebuild downloads headers from incorrect location
I thought that node-gyp
3.0.3
should have this all fixed by taking the data from process.release
but it still downloads from the default one for me:
$ node --version
v4.2.1
$ npm --version
3.3.10
$ node -p process.release
{ name: 'node',
lts: 'Argon',
sourceUrl: 'https://nodejs.org/download/release/v4.2.1/node-v4.2.1.tar.gz',
headersUrl: 'https://nodejs.org/download/release/v4.2.1/node-v4.2.1-headers.tar.gz' }
$ npm i node-sass@3.4.1
Switch to Node 5 & then (notice the incorrect URL https://nodejs.org/dist/v5.0.0-rc.1/node-v5.0.0-rc.1-headers.tar.gz):
$ node --version
v5.0.0-rc.1
$ npm --version
3.3.10
$ node -p process.release
{ name: 'node',
sourceUrl: 'https://nodejs.org/download/rc/v5.0.0-rc.1/node-v5.0.0-rc.1.tar.gz',
headersUrl: 'https://nodejs.org/download/rc/v5.0.0-rc.1/node-v5.0.0-rc.1-headers.tar.gz' }
$ npm rebuild node-sass
> node-sass@3.4.1 install /Users/mgol/_/node_modules/node-sass
> node scripts/install.js
Cannot download "https://github.com/sass/node-sass/releases/download/v3.4.1/darwin-x64-47_binding.node":
HTTP error 404 Not Found
Hint: If github.com is not accessible in your location
try setting a proxy via HTTP_PROXY, e.g.
export HTTP_PROXY=http://example.com:1234
or configure npm proxy via
npm config set proxy http://example.com:8080
> node-sass@3.4.1 postinstall /Users/mgol/_/node_modules/node-sass
> node scripts/build.js
Building: /Users/mgol/.nvm/versions/node/v5.0.0-rc.1/bin/node /Users/mgol/_/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [ '/Users/mgol/.nvm/versions/node/v5.0.0-rc.1/bin/node',
gyp verb cli '/Users/mgol/_/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli 'rebuild',
gyp verb cli '--verbose',
gyp verb cli '--libsass_ext=',
gyp verb cli '--libsass_cflags=',
gyp verb cli '--libsass_ldflags=',
gyp verb cli '--libsass_library=' ]
gyp info using node-gyp@3.0.3
gyp info using node@5.0.0-rc.1 | darwin | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed at F (/Users/mgol/_/node_modules/which/which.js:78:19)
gyp verb `which` failed at E (/Users/mgol/_/node_modules/which/which.js:82:29)
gyp verb `which` failed at /Users/mgol/_/node_modules/which/which.js:93:16
gyp verb `which` failed at FSReqWrap.oncomplete (fs.js:82:15)
gyp verb `which` failed python2 [Error: not found: python2]
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python /usr/bin/python
gyp verb check python version `python -c "import platform; print(platform.python_version());"` returned: "2.7.10\n"
gyp verb get node dir no --target version specified, falling back to host node version: 5.0.0-rc.1
gyp verb command install [ '5.0.0-rc.1' ]
gyp verb install input version string "5.0.0-rc.1"
gyp verb install installing version: 5.0.0-rc.1
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 5.0.0-rc.1
gyp verb ensuring nodedir is created /Users/mgol/.node-gyp/5.0.0-rc.1
gyp verb created nodedir /Users/mgol/.node-gyp/5.0.0-rc.1
gyp http GET https://nodejs.org/dist/v5.0.0-rc.1/node-v5.0.0-rc.1-headers.tar.gz
gyp http 404 https://nodejs.org/dist/v5.0.0-rc.1/node-v5.0.0-rc.1-headers.tar.gz
gyp WARN install got an error, rolling back install
gyp verb command remove [ '5.0.0-rc.1' ]
gyp verb remove using node-gyp dir: /Users/mgol/.node-gyp
gyp verb remove removing target version: 5.0.0-rc.1
gyp verb remove removing development files for version: 5.0.0-rc.1
gyp ERR! configure error
gyp ERR! stack Error: 404 response downloading https://nodejs.org/dist/v5.0.0-rc.1/node-v5.0.0-rc.1-headers.tar.gz
gyp ERR! stack at Request.<anonymous> (/Users/mgol/_/node_modules/node-gyp/lib/install.js:244:14)
gyp ERR! stack at emitOne (events.js:82:20)
gyp ERR! stack at Request.emit (events.js:169:7)
gyp ERR! stack at Request.onRequestResponse (/Users/mgol/_/node_modules/request/request.js:998:10)
gyp ERR! stack at emitOne (events.js:77:13)
gyp ERR! stack at ClientRequest.emit (events.js:169:7)
gyp ERR! stack at HTTPParser.parserOnIncomingClient (_http_client.js:418:21)
gyp ERR! stack at HTTPParser.parserOnHeadersComplete (_http_common.js:88:23)
gyp ERR! stack at TLSSocket.socketOnData (_http_client.js:308:20)
gyp ERR! stack at emitOne (events.js:77:13)
gyp ERR! System Darwin 15.0.0
gyp ERR! command "/Users/mgol/.nvm/versions/node/v5.0.0-rc.1/bin/node" "/Users/mgol/_/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /Users/mgol/_/node_modules/node-sass
gyp ERR! node -v v5.0.0-rc.1
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
Build failed
npm ERR! Darwin 15.0.0
npm ERR! argv "/Users/mgol/.nvm/versions/node/v5.0.0-rc.1/bin/node" "/Users/mgol/.nvm/versions/node/v5.0.0-rc.1/bin/npm" "rebuild" "node-sass"
npm ERR! node v5.0.0-rc.1
npm ERR! npm v3.3.10
npm ERR! code ELIFECYCLE
npm ERR! node-sass@3.4.1 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@3.4.1 postinstall script 'node scripts/build.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the node-sass package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node scripts/build.js
npm ERR! You can get their info via:
npm ERR! npm owner ls node-sass
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/mgol/_/npm-debug.log
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 31 (17 by maintainers)
In case anyone still come here because npm install node-sass cannot be executed because he/she is behind a corporate proxy or needs to work offline.
The root cause of the problem is the post-script of node-sass cannot download binding.node from github.
We need provide the file before it goes to github. Steps:
we’ve moved a step closer with v3.3.0 just out that introduces
NODEJS_ORG_MIRROR
andIOJS_ORG_MIRROR
and deprecates theNVM_*
versions of them and prints a warning on use. We’ll remove those completely from v4 (timeline to be decided …)It’s surprising to me that node-gyp reads
NVM_
env variables which should be reserved for nvm. If an env. variable to set up mirror URLs is desired, I’d expect them to be generic and not influenced by NVM. After all, not only nvm users might want to use those mirrors.I initially thought it’s a node-sass issue because I had a feeling nvm couldn’t break Node in such a way. My intuition was partially right… I just didn’t expect node-gyp to rely on nvm config.
argh
@ljharb: this is going to have to change if you want to support release candidates, node-gyp is now using
NVM_NODEJS_ORG_MIRROR
as well. Alternatively we could remove it from node-gyp but we’ll have to come up with an alternative to support people needing mirrors.