Monday, 23 May 2016

cordova setup , fail to run cordova plugin add org.apache.cordova.device


If you are using any tutorials like this to setup your project, then you will have below issues:


https://ccoenraets.github.io/cordova-tutorial/create-cordova-project.html
http://wiki.jikexueyuan.com/project/apache-cordova-tutorial/implementing-view-routing.html




10:08:22-workshop>cordova plugin add org.apache.cordova.device
WARNING: org.apache.cordova.device has been renamed to cordova-plugin-device. You may not be getting the latest version! We suggest you `cordova plugin rm org.apache.cordova.device` and `cordova plugin add cordova-plugin-device`.
Fetching plugin "org.apache.cordova.device" via cordova plugins registry
npm http GET http://registry.cordova.io/org.apache.cordova.device



npm http GET http://registry.cordova.io/org.apache.cordova.device
npm http GET http://registry.cordova.io/org.apache.cordova.device
Fetching from cordova plugins registry failed: connect ETIMEDOUT
Fetching plugin "org.apache.cordova.device" via npm
npm http GET https://registry.npmjs.org/org.apache.cordova.device
npm http 404 https://registry.npmjs.org/org.apache.cordova.device
TypeError: Cannot read property 'latest' of undefined
    at next (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/lib/cache.js:687:35)
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/lib/cache.js:675:5
    at saved (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/npm-registry-client/lib/get.js:142:7)
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:133:7

    at Object.oncomplete (fs.js:108:15)

Reason:

Cordova has move all plugins to npm, to avoid and stop old things, they have changed plugins'name.

http://cordova.apache.org/announcements/2015/04/21/plugins-release-and-move-to-npm.html

Solution:

change :

cordova plugin add org.apache.cordova.device

to :

cordova plugin add cordova-plugin-device









No comments:

Post a comment