Getting 404 error when trying to add Cordova plugin

Greetings,

We recently started development of our first commercial client project using Ionic, among the requirements are to add geolocation and network status detection, both of which requires additional ngCordova plugins.

Our issue is we are getting 404 on the modules when trying to add them.

$ cordova plugin add cordova-plugin-geolocation
Fetching plugin "cordova-plugin-geolocation" via plugin registry
npm http GET http://registry.cordova.io/cordova-plugin-geolocation
npm http 404 http://registry.cordova.io/cordova-plugin-geolocation
Error: 404 Not Found: cordova-plugin-geolocation
...

And…

$ cordova plugin add cordova-plugin-network-information
Fetching plugin "cordova-plugin-network-information" via plugin registry
npm http GET http://registry.cordova.io/cordova-plugin-network-information
npm http 404 http://registry.cordova.io/cordova-plugin-network-information
Error: 404 Not Found: cordova-plugin-network-information

Is this an issue of our development environment not being properly setup for Ionic development? We have confirmed that at the very least, we can resolve and ping registry.cordova.io

$ ping registry.cordova.io
PING registry.cordova.io (50.17.177.14): 56 data bytes
64 bytes from 50.17.177.14: icmp_seq=0 ttl=45 time=29.422 ms

Any advice would be useful, thank you!

This is because in Cordova 5.0 plugins changed IDs and moved from registry.cordova.io to registry.npmjs.org.

Looks like you have an older version of Cordova, but you’re trying to use the new plugin IDs. Either upgrade Cordova, or use the old plugin IDs, i.e. org.apache.cordova.core.geolocation rather than cordova-plugin-geolocation.

2 Likes

Thank you! I re-ran “npm install -g cordova ionic” as root, deleted ~/.npm; then the commands above worked properly :smile: