如何使用巧克力在Windows上安装PhoneGap?

2024-05-20 00:55:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我不熟悉Node或Python,但我使用过Composer和Gem。安装页面显示http://phonegap.com/install/

C:\>npm install -g phonegap
npm WARN deprecated lodash@1.0.2: lodash@<2.0.0 is no longer maintained. Upgrade to lodash@^3.0.0
npm WARN deprecated npmconf@2.1.2: this package has been reintegrated into npm and is now out of date with respect to npm
npm WARN install:semver@5.0.3 ENOENT: no such file or directory, chmod 'C:\Users\Chloe\AppData\Roaming\npm\node_modules\phonegap\node_modules\cordova-lib\node_modules\cordova-common\node_modules\semver\bin\semver'
npm WARN install:shelljs@0.5.3 ENOENT: no such file or directory, chmod 'C:\Users\Chloe\AppData\Roaming\npm\node_modules\phonegap\node_modules\cordova-lib\node_modules\cordova-common\node_modules\shelljs\bin\shjs'
npm WARN install:tape@3.5.0 ENOENT: no such file or directory, chmod 'C:\Users\Chloe\AppData\Roaming\npm\node_modules\phonegap\node_modules\cordova-lib\node_modules\cordova-registry-mapper\node_modules\tape\bin\tape'
npm WARN install:mkdirp@0.5.1 ENOENT: no such file or directory, chmod 'C:\Users\Chloe\AppData\Roaming\npm\node_modules\phonegap\node_modules\npm\node_modules\mkdirp\bin\cmd.js'
npm WARN install:nopt@3.0.6 ENOENT: no such file or directory, chmod 'C:\Users\Chloe\AppData\Roaming\npm\node_modules\phonegap\node_modules\npm\node_modules\nopt\bin\nopt.js'
npm WARN install:opener@1.4.1 ENOENT: no such file or directory, chmod 'C:\Users\Chloe\AppData\Roaming\npm\node_modules\phonegap\node_modules\npm\node_modules\opener\opener.js'
npm WARN install:sshpk@1.7.1 ENOENT: no such file or directory, chmod 'C:\Users\Chloe\AppData\Roaming\npm\node_modules\phonegap\node_modules\npm\node_modules\request\node_modules\http-signature\node_modules\sshpk\bin\sshpk-conv'
npm WARN install:node-uuid@1.4.7 ENOENT: no such file or directory, chmod 'C:\Users\Chloe\AppData\Roaming\npm\node_modules\phonegap\node_modules\npm\node_modules\request\node_modules\node-uuid\bin\uuid'
npm WARN install:semver@5.1.0 ENOENT: no such file or directory, chmod 'C:\Users\Chloe\AppData\Roaming\npm\node_modules\phonegap\node_modules\npm\node_modules\semver\bin\semver'
npm WARN install:har-validator@2.0.3 ENOENT: no such file or directory, chmod 'C:\Users\Chloe\AppData\Roaming\npm\node_modules\phonegap\node_modules\npm\node_modules\request\node_modules\har-validator\bin\har-validator'
npm WARN install:which@1.2.0 ENOENT: no such file or directory, chmod 'C:\Users\Chloe\AppData\Roaming\npm\node_modules\phonegap\node_modules\npm\node_modules\which\bin\which'
npm WARN install:rimraf@2.4.4 ENOENT: no such file or directory, chmod 'C:\Users\Chloe\AppData\Roaming\npm\node_modules\phonegap\node_modules\npm\node_modules\rimraf\bin.js'

> bufferutil@1.2.1 install C:\Users\Chloe\AppData\Roaming\npm\node_modules\phonegap\node_modules\bufferutil
> node-gyp rebuild


C:\Users\Chloe\AppData\Roaming\npm\node_modules\phonegap\node_modules\bufferutil>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 )  else (node  rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Python executable "python" is v3.5.1, which is not supported by gyp.
gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.
gyp ERR! stack     at failPythonVersion (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:121:14)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:110:9
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:204:7)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at maybeClose (internal/child_process.js:821:16)
gyp ERR! stack     at Socket.<anonymous> (internal/child_process.js:319:11)
gyp ERR! stack     at emitOne (events.js:77:13)
gyp ERR! stack     at Socket.emit (events.js:169:7)
gyp ERR! stack     at Pipe._onclose (net.js:469:12)
gyp ERR! System Windows_NT 6.3.9600
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\Chloe\AppData\Roaming\npm\node_modules\phonegap\node_modules\bufferutil
gyp ERR! node -v v5.4.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN install:bufferutil@1.2.1 bufferutil@1.2.1 install: `node-gyp rebuild`
npm WARN install:bufferutil@1.2.1 Exit status 1

> utf-8-validate@1.2.1 install C:\Users\Chloe\AppData\Roaming\npm\node_modules\phonegap\node_modules\utf-8-validate
> node-gyp rebuild


C:\Users\Chloe\AppData\Roaming\npm\node_modules\phonegap\node_modules\utf-8-validate>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 )  else (node  rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Python executable "python" is v3.5.1, which is not supported by gyp.
gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.
gyp ERR! stack     at failPythonVersion (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:121:14)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:110:9
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:204:7)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at maybeClose (internal/child_process.js:821:16)
gyp ERR! stack     at Socket.<anonymous> (internal/child_process.js:319:11)
gyp ERR! stack     at emitOne (events.js:77:13)
gyp ERR! stack     at Socket.emit (events.js:169:7)
gyp ERR! stack     at Pipe._onclose (net.js:469:12)
gyp ERR! System Windows_NT 6.3.9600
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\Chloe\AppData\Roaming\npm\node_modules\phonegap\node_modules\utf-8-validate
gyp ERR! node -v v5.4.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN install:utf-8-validate@1.2.1 utf-8-validate@1.2.1 install: `node-gyp rebuild`
npm WARN install:utf-8-validate@1.2.1 Exit status 1

C:\>

我错误地安装了python,但它说它不喜欢它。我卸载了它,但它不会消失。在

^{pr2}$

我安装了python2并且似乎已经安装了它。在

C:\>py --version
Python 2.7.11

我也试过了

C:\>npm install -g phonegap --python py

但它也有错误

gyp ERR! configure error
gyp ERR! stack Error: Python executable "true" is v, which is not supported by gyp.
gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.

版本

C:\>npm -v
3.3.12

Windows 8.1,x64


Tags: installmodulesnodenpmbinstackjsusers