npm包安装Windows的python错误

时间:2017-06-08 09:49:14

标签: windows npm

在Windows上,当我尝试安装wdio时,我遇到了一个python错误: 但是python安装在路径中。 PYTHON变量设置为" C:\ Program Files \ Python36 \ python.exe",这是一个正确的路径。 我不知道错误的来源,因为它说它可以找到可执行文件,bit显示可执行文件的正确路径。

PS C:\Users\admin> npm install wdio

> fibers@1.0.15 install C:\Users\admin\node_modules\fibers
> node build.js || nodejs build.js


C:\Users\admin\node_modules\fibers>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild --release )  else (node "" rebuild --release )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "C:\Program Files\Python36\python.exe", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack     at PythonFinder.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Windows_NT 10.0.15063
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" "--release"
gyp ERR! cwd C:\Users\admin\node_modules\fibers
gyp ERR! node -v v8.0.0
gyp ERR! node-gyp -v v3.6.1
gyp ERR! not ok
node-gyp exited with code: 1
Please make sure you are using a supported platform and node version. If you
would like to compile fibers on this machine please make sure you have setup your
build environment--
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\admin\package.json'

2 个答案:

答案 0 :(得分:0)

您需要安装Python 2.7,因为node-gyp与Python 3.x不兼容。参见例如https://github.com/nodejs/node-gyp#on-windows

答案 1 :(得分:0)

遇到类似问题时,我不得不重新安装节点(此问题已更新到当前的稳定版本),尽管在尝试包括Windows和node-gyp(npm install -g node-gyp的python在内的解决方案时,我已经更新了所有其他内容。 。节点js更新终于做到了

相关问题