首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >无法使用npm在windows 10上安装zerorpc

无法使用npm在windows 10上安装zerorpc
EN

Stack Overflow用户
提问于 2019-07-24 19:18:42
回答 1查看 861关注 0票数 0

首先,我检查了How to install zeroRPC (python) on windows,但没有找到我的问题的答案。

我试图在python中安装zerorpc以使用Electronjs,使用:

代码语言:javascript
运行
复制
npm install zerorpc --save

这是一个错误:

代码语言:javascript
运行
复制
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

另外,这是我的package.json:

代码语言:javascript
运行
复制
{
  "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"
  }
}

我一直在学习本教程:https://github.com/fyears/electron-python-example

我的系统:

  • 操作系统: Windows 10。
  • 2017
  • Python 3.7和2.7
  • Node LTS的最后版本
  • 电子的最后版本

编辑:我已经安装了windows构建工具。

代码语言:javascript
运行
复制
npm install -g zerorpc
代码语言:javascript
运行
复制
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
EN

Stack Overflow用户

发布于 2019-11-05 10:15:56

这是因为您已经安装了python3而不是python2 (正如您应该安装的那样),但是zeromq需要python2。

在计算机上安装Python2并修改PATH变量,以便在python3之前找到python2。之后,您应该能够运行安装命令。别忘了以后再改!

如果这个答案来不及了,我很抱歉。

票数 0
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57189848

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档