phonegap将不会安装或正常工作

在安装NodeJs并运行npm install -g phonegap之后,我得到的结果与应该是完全不同的格式:

C:\Program Files\nodejs>npm install -g phonegap | > ws@0.4.31 install C:\Users\kyle David Krueger\AppData\Roaming\npm\node_modules \phonegap\node_modules\connect-phonegap\node_modules\socket.io\node_modules\engi ne.io\node_modules\ws > (node-gyp rebuild 2> builderror.log) || (exit 0) / C:\Users\kyle David Krueger\AppData\Roaming\npm\node_modules\phonegap\node_modul es\connect-phonegap\node_modules\socket.io\node_modules\engine.io\node_modules\w s>node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_mo dules\node-gyp\bin\node-gyp.js" rebuild - > ws@0.4.31 install C:\Users\kyle David Krueger\AppData\Roaming\npm\node_modules \phonegap\node_modules\connect-phonegap\node_modules\socket.io\node_modules\sock et.io-client\node_modules\engine.io-client\node_modules\ws > (node-gyp rebuild 2> builderror.log) || (exit 0) - C:\Users\kyle David Krueger\AppData\Roaming\npm\node_modules\phonegap\node_modul es\connect-phonegap\node_modules\socket.io\node_modules\socket.io-client\node_mo dules\engine.io-client\node_modules\ws>node "C:\Program Files\nodejs\node_module s\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild C:\Users\kyle David Krueger\AppData\Roaming\npm\phonegap -> C:\Users\kyle David Krueger\AppData\Roaming\npm\node_modules\phonegap\bin\phonegap.js phonegap@3.5.0-0.21.14 C:\Users\kyle David Krueger\AppData\Roaming\npm\node_modu les\phonegap ├── pluralize@0.0.4 ├── semver@1.1.0 ├── colors@0.6.0-1 ├── minimist@0.1.0 ├── qrcode-terminal@0.9.4 ├── shelljs@0.1.4 ├── cordova@3.5.0-0.2.7 (q@0.9.7, underscore@1.4.4, nopt@2.2.1) ├── prompt@0.2.11 (revalidator@0.1.8, pkginfo@0.3.0, read@1.0.5, utile@0.2.1, wi nston@0.6.2) ├── phonegap-build@0.8.4 (qrcode-terminal@0.8.0, shelljs@0.0.9, optimist@0.3.7, phonegap-build-api@0.3.3) ├── connect-phonegap@0.12.8 (home-dir@0.1.2, connect-inject@0.3.2, shelljs@0.2.6 , request-progress@0.3.1, useragent@2.0.8, gaze@0.4.3, node-static@0.7.0, tar@0. 1.19, request@2.33.0, localtunnel@1.3.0, socket.io@1.0.6, connect@2.12.0) └── cordova-lib@0.21.7 (osenv@0.0.3, properties-parser@0.2.3, mime@1.2.11, bplis t-parser@0.0.5, q@0.9.7, semver@2.0.11, underscore@1.4.4, dep-graph@1.1.0, plist -with-patches@0.5.1, npmconf@0.1.16, rc@0.3.0, xcode@0.6.6, elementtree@0.1.5, g lob@3.2.11, tar@0.1.19, request@2.22.0, cordova-js@3.6.2, npm@1.3.4) 

但是,这似乎工作,因为我可以创build新的phonegap项目,但也有错误:

 C:\Users\kyle David Krueger\workspace>phonegap create aoeu com.kdk.aoeu aoeu [phonegap] missing library com.kdk.aoeu/www/3.5.0 [phonegap] downloading https://github.com/phonegap/phonegap-app-hello-world/arch ive/3.5.0.tar.gz... [phonegap] create called with the options C:\Users\kyle David Krueger\workspace\ aoeu com.kdk.aoeu aoeu [phonegap] Customizing default config.xml file [phonegap] created project at C:\Users\kyle David Krueger\workspace\aoeu 

然后试图运行android手机运行android导致类似的情况,似乎工作,但有错误

 C:\Users\kyle David Krueger\workspace\aoeu>phonegap run android [phonegap] detecting Android SDK environment... [phonegap] using the local environment [phonegap] adding the Android platform... C:\Users\kyle David Krueger\.cordova\lib\android\cordova\3.5.1\bin\node_modules\ q\q.js:126 throw e; ^ Error: ERROR : executing command 'ant', make sure you have ant installed and add ed to your path. at C:\Users\kyle David Krueger\.cordova\lib\android\cordova\3.5.1\bin\lib\ch eck_reqs.js:47:27 at ChildProcess.exithandler (child_process.js:652:7) at ChildProcess.emit (events.js:98:17) at maybeClose (child_process.js:756:16) at Socket.<anonymous> (child_process.js:969:11) at Socket.emit (events.js:95:17) at Pipe.close (net.js:465:12) { [Error: cmd: Command failed with exit code 8] code: 8 } [error] cmd: Command failed with exit code 8 

最后,打开Eclipse,并试图创build一个新的项目,导致错误“parseSdkContent失败”。 这实际上出现之前,甚至select要导入的文件,也出现时,从头开始创build一个全新的android应用程序。 看起来这可能都是由于多个错误,或者这可能都是由一个错误引起的。

您需要从http://ant.apache.org/bindownload.cgi手动下&#x8F7D;ant

然后提取它的地方。 假设在驱动器D:\apache-ant-1.9.3

接下来添加环境variablesANT_HOME ,值为D:\apache-ant-1.9.3

最后将其添加到pathvariables%ANT_HOME%\bin

不要忘记重新启动terminal或命令提示符