【问题标题】:Unable to install Phonegap: gyp ERR! configure error无法安装 Phonegap:gyp ERR!配置错误
【发布时间】:2015-12-21 09:46:41
【问题描述】:

我正在关注tutorial 安装phonegap。我的电脑是 Windows 7 64 位。

但是,当我在上述教程的第 4 步中运行 npm install -g phonegap 时,我遇到了错误。 CMD中显示的错误如下

> ws@0.4.31 install C:\Users\Yohan\AppData\Roaming\npm\node_modules\phonegap\nod
e_modules\connect-phonegap\node_modules\socket.io\node_modules\engine.io\node_mo
dules\ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)

/
C:\Users\Yohan\AppData\Roaming\npm\node_modules\phonegap\node_modules\connect-ph
onegap\node_modules\socket.io\node_modules\engine.io\node_modules\ws>if not defi
ned npm_config_node_gyp (node "C:\Program Files (x86)\nodejs\node_modules\npm\bi
n\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (no
de  rebuild )

> ws@0.4.31 install C:\Users\Yohan\AppData\Roaming\npm\node_modules\phonegap\nod
e_modules\connect-phonegap\node_modules\socket.io\node_modules\socket.io-client\
node_modules\engine.io-client\node_modules\ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)

|
C:\Users\Yohan\AppData\Roaming\npm\node_modules\phonegap\node_modules\connect-ph
onegap\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.
io-client\node_modules\ws>if not defined npm_config_node_gyp (node "C:\Program F
iles (x86)\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp
\bin\node-gyp.js" rebuild )  else (node  rebuild )
^CTerminate batch job (Y/N)? y

builderror.log 文件包含以下信息。

gyp ERR! configure error 
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at failNoPython (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:116:14)
gyp ERR! stack     at C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:71:11
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:82:15)
gyp ERR! System Windows_NT 6.1.7600
gyp ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Yohan\AppData\Roaming\npm\node_modules\phonegap\node_modules\connect-phonegap\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws
gyp ERR! node -v v4.2.3
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 

如何解决此问题并正确安装 phonegap?

【问题讨论】:

  • 博客条目有点过时了。是的,截至几周前,Cordova/Phonegap 现在正在发布 Android SDK 23 和 iOS9。试试这个博客,看看它是否可以帮助你iPhoneDevlog。作者经常光顾Google Groups,以便获得更多帮助
  • 如果您的错误日志表明已经安装了 python,为什么不尝试安装 python 或设置 env-variable PYTHON?

标签: android node.js cordova phonegap-plugins phonegap-build


【解决方案1】:

如果可能,尝试使用当前稳定版本重新安装 node.js。

然后在你的命令提示符下

npm install -g phonegap@latest

祝你好运

【讨论】:

  • 所有东西都是新安装的。 python有什么用吗?
  • 对于 Node 是 --> 当前版本:v4.2.3 注意:从源代码 tarball 构建需要 Python 2.6 或 2.7。参考:nodejs.org/en/download
猜你喜欢
  • 2018-06-17
  • 2023-03-25
  • 2015-09-09
  • 2020-03-06
  • 2016-09-05
  • 1970-01-01
  • 2016-09-26
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多