0rpc / zerorpc-node

zerorpc for node.js
http://www.zerorpc.io
Other
705 stars 167 forks source link

npm install #107

Open thisisashukla opened 5 years ago

thisisashukla commented 5 years ago

Hi. I am trying to install the zerorpc-node on my system with Windows 10. Python 3.5 and Nodejs 10.16.0. When i run npm install i get the following error

`npm install git+https://github.com/0rpc/zerorpc-node.git

zeromq@4.6.0 install path\node_modules\zeromq node scripts/prebuild-install.js || (node scripts/preinstall.js && node-gyp rebuild)

prebuild-install WARN install No prebuilt binaries found (target=10.16.0 runtime=node arch=x64 platform=win32)

Downloading libzmq for Windows Download finished

path\node_modules\zeromq>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild ) gyp ERR! configure error gyp ERR! stack Error: Command failed: path\AppData\Local\Programs\Python\Python35\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3]; gyp ERR! stack File "", line 1 gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3]; gyp ERR! stack ^ gyp ERR! stack SyntaxError: invalid syntax gyp ERR! stack gyp ERR! stack at ChildProcess.exithandler (child_process.js:294:12) gyp ERR! stack at ChildProcess.emit (events.js:198:13) gyp ERR! stack at maybeClose (internal/child_process.js:982:16) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5) gyp ERR! System Windows_NT 10.0.16299 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild" gyp ERR! cwd path\node_modules\zeromq gyp ERR! node -v v10.16.0 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! zeromq@4.6.0 install: node scripts/prebuild-install.js || (node scripts/preinstall.js && node-gyp rebuild) npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the zeromq@4.6.0 install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! path\AppData\Roaming\npm-cache_logs\2019-06-07T06_09_01_680Z-debug.log`

Is this repo not compatible with Python 3.5? How is a node module dependent on Python?

thisisashukla commented 5 years ago

Any help would be appreciated. Thanks

TouiSoraHe commented 5 years ago

I also encountered the same problem.

daniel0076 commented 5 years ago

The package requires python2.x to do final setup, and it looks for python rather than python2, so just make sure your python goes to python2.x

bruno-robert commented 4 years ago

I'm also getting the same issue, tried alias python=python2 to no avail

gabrielgrant commented 4 years ago

@bruno-robert i think to work around this by using Python 2 you want to create a symlink (something like ln -s /usr/bin/python2 /usr/local/bin/python?), rather than an alias

That being said, it looks like newer versions of node-gyp have now added Python 3 support: https://github.com/nodejs/node-gyp/issues/1687#issuecomment-541471076

Not 100% sure of the chain of events, but it seems like the zmq bindings are looking for a globally-installed version before falling back to their own version of gyp? So maybe try installing the latest node-gyp manually? (npm install -g node-gyp)

bruno-robert commented 4 years ago

It looks like it's using an old version of node-gyp that is bundled with npm.

Installing node-gyp globally only updates the global version, not npm's version. $ node-gyp -v -> v7.0.0

but npm's node-gyp remains at an older version /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js -v -> v5.1.0

Either updating npm's node-gyp or getting npm to use the global node-gyp would fix this I believe.

I haven't had time to try the symlink trick. I will give it a go at some point.

EDIT:

Tried updating npm's packaged node-gyp with: npm explore npm -g -- npm install node-gyp@latest (instructions for *nix/windows here)

zerorpc installation is still failing even with node-gyp v7.0.0

gabrielgrant commented 4 years ago

@bruno-robert hmmm, what's the error now?

bruno-robert commented 4 years ago

Since I didn't have the logs on me, I just retried installing zerorpc in a fresh folder after restart. It seems to have successfully installed (with multiple warning: 'MakeCallback' is deprecated [-Wdeprecated-declarations] warnings).