Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm install fails with iojs v1.0.1 #141

Closed
ralphtheninja opened this issue Jan 15, 2015 · 12 comments
Closed

npm install fails with iojs v1.0.1 #141

ralphtheninja opened this issue Jan 15, 2015 · 12 comments

Comments

@ralphtheninja
Copy link
Member

I'm having problems building node-leveldown with node-gyp. Any suggestions? Please excuse me if this has already been reported.

lms@ux31a|21:44|~/src/node-leveldown (nan-1.5) $ node -v
v1.0.1
lms@ux31a|21:46|~/src/node-leveldown (nan-1.5) $ iojs -v
v1.0.1
lms@ux31a|21:46|~/src/node-leveldown (nan-1.5) $ npm -v
2.1.18
lms@ux31a|21:44|~/src/node-leveldown (nan-1.5) $ npm i

> [email protected] install /home/lms/src/node-leveldown
> node-gyp rebuild

gyp WARN install got an error, rolling back install
gyp ERR! configure error 
gyp ERR! stack Error: 404 status code downloading tarball
gyp ERR! stack     at Request.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:246:14)
gyp ERR! stack     at Request.emit (events.js:117:20)
gyp ERR! stack     at Request.onRequestResponse (/usr/local/lib/node_modules/npm/node_modules/request/request.js:1255:10)
gyp ERR! stack     at ClientRequest.emit (events.js:95:17)
gyp ERR! stack     at HTTPParser.parserOnIncomingClient (_http_client.js:399:21)
gyp ERR! stack     at HTTPParser.parserOnHeadersComplete (_http_common.js:89:23)
gyp ERR! stack     at Socket.socketOnData (_http_client.js:290:20)
gyp ERR! stack     at Socket.emit (events.js:95:17)
gyp ERR! stack     at readableAddChunk (_stream_readable.js:143:16)
gyp ERR! stack     at Socket.Readable.push (_stream_readable.js:106:10)
gyp ERR! System Linux 3.13.0-44-generic
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/lms/src/node-leveldown
gyp ERR! node -v v1.0.1
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok 

npm ERR! Linux 3.13.0-44-generic
npm ERR! argv "node" "/usr/local/bin/npm" "i"
npm ERR! node v1.0.1
npm ERR! npm  v2.1.18
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the leveldown 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 leveldown
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/lms/src/node-leveldown/npm-debug.log
@ralphtheninja
Copy link
Member Author

Aha, this is most likely the exact problem as nodejs/node#433

@ralphtheninja
Copy link
Member Author

My npm-debug.log is mega sized so can't paste it here. I have a copy of it and can mail it if it's required.

@ralphtheninja
Copy link
Member Author

Ok, so after some investigation I've come to the conclusion that node-gyp is trying to download files based on nodejs.org which is set here:

https://github.com/TooTallNate/node-gyp/blob/4ceed113a800378e78435a42632fd035413c99b2/lib/install.js#L42

You can affect the base url by using --disturl options:

$ node-gyp rebuild --disturl=https://iojs.org/dist
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp http GET https://iojs.org/dist/v1.0.1/node-v1.0.1.tar.gz
gyp http 404 https://iojs.org/dist/v1.0.1/node-v1.0.1.tar.gz
gyp WARN install got an error, rolling back install
gyp ERR! configure error 
gyp ERR! stack Error: 404 status code downloading tarball
gyp ERR! stack     at Request.<anonymous> (/home/lms/src/node-gyp/lib/install.js:246:14)
gyp ERR! stack     at Request.emit (events.js:117:20)
gyp ERR! stack     at Request.onResponse (/home/lms/src/node-gyp/node_modules/request/index.js:815:10)
gyp ERR! stack     at ClientRequest.g (events.js:181:16)
gyp ERR! stack     at ClientRequest.emit (events.js:95:17)
gyp ERR! stack     at HTTPParser.parserOnIncomingClient (_http_client.js:399:21)
gyp ERR! stack     at HTTPParser.parserOnHeadersComplete (_http_common.js:89:23)
gyp ERR! stack     at TLSSocket.socketOnData (_http_client.js:290:20)
gyp ERR! stack     at TLSSocket.emit (events.js:95:17)
gyp ERR! stack     at readableAddChunk (_stream_readable.js:143:16)
gyp ERR! System Linux 3.13.0-44-generic
gyp ERR! command "node" "/usr/local/bin/node-gyp" "rebuild" "--disturl=https://iojs.org/dist"
gyp ERR! cwd /home/lms/src/node-leveldown
gyp ERR! node -v v1.0.1
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok 

But then we run into problems because the following line assumes node and also .tar.gz and not .tar.xz which afaik is the format for iojs:

https://github.com/TooTallNate/node-gyp/blob/4ceed113a800378e78435a42632fd035413c99b2/lib/install.js#L188

I guess after this it feels more of an issue that should be posted on node-gyp.

@timoxley
Copy link

nodejs/node#456

@ralphtheninja
Copy link
Member Author

Ignore the part with .tar.gz and .tar.xz. The latter is only used on iojs.org for smaller file size. The .tar.gz is also available so this is not an issue for node-gyp

@ralphtheninja
Copy link
Member Author

Ok with some npmlinking help from @rvagg I now pass the install step but get an error which is related to the nan module

lms@ux31a|01:35|~/src/node-leveldown (nan-1.5) $ node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp http GET https://iojs.org/dist/v1.0.1/iojs-v1.0.1.tar.gz
gyp http 200 https://iojs.org/dist/v1.0.1/iojs-v1.0.1.tar.gz
gyp http GET https://iojs.org/dist/v1.0.1/SHASUMS256.txt
gyp http 200 https://iojs.org/dist/v1.0.1/SHASUMS256.txt
child_process: customFds option is deprecated, use stdio instead.
gyp info spawn python
gyp info spawn args [ '/usr/local/lib/iojs-v1.0.1-linux-x64/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/home/lms/src/node-leveldown/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/local/lib/iojs-v1.0.1-linux-x64/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/lms/.node-gyp/1.0.1/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/lms/.node-gyp/1.0.1',
gyp info spawn args   '-Dmodule_root_dir=/home/lms/src/node-leveldown',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
module.js:324
    throw err;
          ^
Error: Cannot find module 'nan'
    at Function.Module._resolveFilename (module.js:322:15)
    at Function.Module._load (module.js:264:25)
    at Module.require (module.js:351:17)
    at require (module.js:370:17)
    at [eval]:1:1
    at Object.exports.runInThisContext (vm.js:55:17)
    at Object.<anonymous> ([eval]-wrapper:6:22)
    at Module._compile (module.js:446:26)
    at evalScript (node.js:413:25)
    at startup (node.js:72:7)
gyp: Call to 'node -e "require('nan')"' returned exit status 1. while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/iojs-v1.0.1-linux-x64/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:343:16)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1038:12)
gyp ERR! System Linux 3.13.0-44-generic
gyp ERR! command "node" "/usr/local/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/lms/src/node-leveldown
gyp ERR! node -v v1.0.1
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok 

@rvagg
Copy link
Member

rvagg commented Jan 16, 2015

#139 was just merged, [email protected] + [email protected] should be 💘

@rvagg rvagg closed this as completed Jan 16, 2015
@rvagg
Copy link
Member

rvagg commented Jan 16, 2015

also, don't use node-gyp to do manual compiles, use the one bundled with io.js releases, the changes haven't been upstreamed yet: /usr/local/lib/node_modules/npm/node_modules/node-gyp or something similar. You can extract / npm link that if you want a global but that version of npm will use it by default.

@ralphtheninja
Copy link
Member Author

Ok just going to summarize what I had to do in case anyone else reads this. YMMV.

  1. npm link in /usr/local/lib/iojs-v1.0.2-linux-x64/lib/node_modules/npm/node_modules/node-gyp
  2. npm link node-gyp in node-leveldown folder
  3. npm install in node-leveldown did not work -> Had to do node-gyp rebuild manually. This step is only a problem the first time node-gyp downloads from iojs.org, i.e. subsequent npm i works.

@fundon
Copy link

fundon commented Jan 18, 2015

Maybe these places need to replace.
https://github.com/TooTallNate/node-gyp/blob/master/lib/install.js#L188
https://github.com/TooTallNate/node-gyp/blob/master/lib/install.js#L346
...

//https://github.com/TooTallNate/node-gyp/blob/master/lib/install.js#L188
 var tarballUrl = tarPath ? tarPath : distUrl + '/v' + version + '/iojs-v' + version + '.tar.gz'

@rvagg
Copy link
Member

rvagg commented Jan 18, 2015

work in progress nodejs/node-gyp#564

@rvagg
Copy link
Member

rvagg commented Jan 18, 2015

see also pangyp as a stop-gap replacement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants