简体   繁体   中英

unable to install zerorpc on windows 10 using npm

First of all, I've checked How to install zeroRPC (python) on windows , but couldn't find an answer to my question.

I'm trying to install zerorpc to use Electronjs with python, using:

npm install zerorpc --save

This is the error:

npm ERR! path git
npm ERR! code ENOENT
npm ERR! errno ENOENT
npm ERR! syscall spawn git
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t https://github.com/fyears/zerorpc-node.git
npm ERR! enoent
npm ERR! enoent
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\TXJ0890\AppData\Roaming\npm-cache\_logs\2019-07-24T19_07_27_933Z-debug.log

Also, this is my package.json:

{
  "name": "pretty-calculator",
  "main": "main.js",
  "scripts": {
    "start": "electron ."
  },
  "dependencies": {
    "zerorpc": "git+https://github.com/fyears/zerorpc-node.git"
  },
  "devDependencies": {
    "electron": "^5.0.7",
    "electron-rebuild": "^1.8.5"
  }
}

I have been following this tutorial: https://github.com/fyears/electron-python-example

My system:

  • OS: Windows 10.
  • Visual Studio 2017
  • Python 3.7 and 2.7
  • Last version of Node LTS
  • Last version of Electron

Edit: I have already installed the windows-build-tools.

npm install -g zerorpc
C:\Users\TXJ0890\OneDrive - Shire PLC\Desktop\python\Electronjs>npm install -g zerorpc

> zeromq@4.6.0 install C:\Users\TXJ0890\AppData\Roaming\npm\node_modules\zerorpc\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

C:\Users\TXJ0890\AppData\Roaming\npm\node_modules\zerorpc\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: C:\Users\TXJ0890\AppData\Local\Programs\Python\Python37-32\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", 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 C:\Users\TXJ0890\AppData\Roaming\npm\node_modules\zerorpc\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!     C:\Users\TXJ0890\AppData\Roaming\npm-cache\_logs\2019-07-24T19_43_18_756Z-debug.log

First Install windows-build-tools, do the following in an administrative powershell:

npm install -g --production --windows-build-tools
added 128 packages in 460.125s

Now the following will works:

npm install -g zerorpc

This is because you have python3 installed instead of python2 (as you should), but zeromq requires python2.

Install Python2 on your computer and modify the PATH variable so that it finds python2 before python3. After that you should be able to run your installation command. Remember to change it afterwards!

I'm sorry if this answer has come too late.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM