Cordova 无法获取 Android

Cordova 无法获取 Android

我正在使用 Meteor 的第一个应用程序教程并且无法让我的应用程序在Android手机或模拟器上运行。以下是我最初在 Stack Overflow 上提出的问题,最初是为了寻求帮助解决意外meteor add-platform android错误,最后却变成了我尝试修复它的过程的记录。我现在遇到的问题似乎更适合 Ask Ubuntu。

目前,这是我遇到的问题:

   sarah@sarah-ThinkPad-X220:~/simple-todos$ meteor add-platform --verbose android
Adding platform Android to Cordova project    
=> Errors executing Cordova commands:         

   While adding platform Android to Cordova project:
   Cordova error: CordovaError: Failed to fetch platform android
   Probably this is either a connection problem, or platform spec is incorrect.
   Check your connection and platform name/version/URL.
   undefined
   at
   /home/sarah/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/cordova-lib/src/cordova/platform.js:270:25
   at _rejected
   (/home/sarah/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/q/q.js:797:24)
   at
   /home/sarah/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/q/q.js:823:30
   at Promise.when
   (/home/sarah/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/q/q.js:1035:31)
   at Promise.promise.promiseDispatch
   (/home/sarah/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/q/q.js:741:41)
   at
   /home/sarah/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/q/q.js:557:44
   at flush
   (/home/sarah/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/q/q.js:108:17)
   at process._tickCallback (node.js:448:13)
   (If the error message contains suggestions for a fix, note that this may not apply to the Meteor integration. You can try
   running again with the --verbose option to help diagnose the issue.)

这似乎是一个cordova我不确定如何解决的问题。我尝试清除 Cordova 缓存,但没有任何变化。我还尝试重新安装cordova,成功了,但给出了以下警告:

sarah@sarah-ThinkPad-X220:~/simple-todos$ sudo npm install -g cordova
npm WARN engine [email protected]: wanted: {"node":">=0.12.0","iojs":">=1.0.0"} (current: {"node":"0.10.25","npm":"1.4.21"})
npm WARN deprecated [email protected]: this package has been reintegrated into npm and is now out of date with respect to npm
npm WARN engine [email protected]: wanted: {"node":">= 0.12.0","npm":">= 2.5.1"} (current: {"node":"0.10.25","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=0.12"} (current: {"node":"0.10.25","npm":"1.4.21"})
/usr/local/bin/cordova -> /usr/local/lib/node_modules/cordova/bin/cordova
[email protected] /usr/local/lib/node_modules/cordova
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])

下一步我应该尝试什么?

答案1

我已经修复了这个问题!我只需要删除npm_cache目录。

$ sudo rm -r ~/.cordova/lib/npm_cache

相关内容