Ionic Start Failure

Initializing cordova project
Fetching plugin “org.apache.cordova.device” via plugin registry
npm ERR! registry error parsing json
SyntaxError: Unexpected token <

at Object.parse (native)
at RegClient.<anonymous> (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:274:23)
at Request._callback (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:246:65)
at Request.self.callback (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/request/request.js:236:22)
at Request.emit (events.js:98:17)
at Request.<anonymous> (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/request/request.js:1142:14)
at Request.emit (events.js:117:20)
at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/request/request.js:1096:12)
at IncomingMessage.emit (events.js:117:20)
at _stream_readable.js:929:16

Unable to add plugins. Perhaps your version of Cordova is too old. Try updating (npm install -g cordova), removing this project folder, and trying again. (CLI v1.3.10)

Your system information:

OS: Mac OS X Mavericks
Node Version: v0.10.29
Cordova CLI: 4.2.0
Ionic Version: 1.0.0-beta.14
Ionic CLI Version: 1.3.10
Xcode version: Xcode 4.6.3 Build version 4H1503
ios-sim version: Not installed

I’ve downgraded cordova to 4.1.2, but still meet this issue. Anyone could help?

What command are using to install the plugin, like $ cordova ...

sudo npm install -g cordova
which installs the latest version, namely 4.2.0, on my Mac.

When I met the error, I uninstall it and specifically install the older version 4.1.2, because I learned from another post that 4.1.2 should work.

sudo npm install -g cordova@4.1.2


Is that error happening when you try to install the plugin or when you are creating a new app?

I didn’t install any plugin specifically. I simply run

ionic start XX blank

When Ionic starts, it must have installed plugins, like org.apache.cordova.device.

Create a new app. Maybe I should try install the plugin by myself manually and see if I could workaround it.

Yeh run $ cordova plugin add org.apache.cordova.device and see if you get the same error.

I can’t do it under a Ionic project, error:

Current working directory is not a Cordova-based project.

However, I tried under a Cordova project. Ahhh, I got the same exception.

This is a stupid question. but you definitely are in the right directory, when adding the plugin?

I have to admit I’m new to Cordova, let alone Ionic. But you know, Yes, I’m right under the app directory and run the command. That is I create an app like below:

cordova create hello com.example.hello HelloWorld

And after cd hello, I run the plugin command. BTW, I’m able to build the app and add platforms like Android in the app.

For Ionic, I don’t get it. I run the basic command ionic start to create the app and meet the exception, What could I do then?

Could it be a gateway issue? Because I met the same exception while adding other plugins?

cordova plugin add
Fetching plugin “” via plugin registry
npm http GET
npm http 403
npm ERR! registry error parsing json
SyntaxError: Unexpected token <

Sorry for bothering your time. Yep, It’s a gateway issue. When I changed to use a public WIFI, everything goes fine.

Haha that’s alright! Just glad you’ve got it working.

It’s caused by the gateway. I’ve resolved the problem by changing my network connection.