3

I try updating my ionic cordova cli when i started getting issues installing the two package, but now ionic have been successfully installed and i have tried installing the cordova now, all attempt was not successful This is the error message am getting

$ npm install -g cordova
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "c:\\Program Files\\nodejs\\node.exe" "c:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "cordova"
npm ERR! node v0.12.0
npm ERR! npm  v2.5.1
npm ERR! file C:\Users\Akinsanya Olanrewaju\AppData\Roaming\npm-cache\cordova-js
\3.7.3\package\package.json
npm ERR! code EJSONPARSE

npm ERR! Failed to parse json
npm ERR! Unexpected token
npm ERR! File: C:\Users\Akinsanya Olanrewaju\AppData\Roaming\npm-cache\cordova-j
s\3.7.3\package\package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse

npm ERR! Please include the following file with any support request:
npm ERR!     f:\npm-debug.log

Please i need you help as am in the middle of a project, maybe any other sources of installing cordova on my machine except from npm will be appreciated or any ways to fix this issues.

Thanks.

9 Answers9

7

I just want to add an official answer to Swaminathan Vetri suggestion. Here's exactly what I did to resolve:

sudo npm cache clean make sure to run with sudo

and then,

sudo npm install -g cordova again make sure to run with sudo.

Thanks!

Ryan Macdonald
  • 116
  • 3
  • 6
2

Thank you all for your answer, i have had the issues resolve from all of your contribution. This are the step i followed.

  1. npm cache clean
  2. Bring back the node version to v0.10.36 as suggested that the latest version of node may not be compatible for the new cli for window users.
  3. Run the node cli or cmd in admin mode
  4. npm install -g cordova

Thank your all for your time and contribution

1

try running the command

npm cache clean first

and then re-install the package by running

npm install -g cordova

Swaminathan Vetri
  • 403
  • 1
  • 4
  • 11
  • after npm cache clean, This is the error i get, $ npm install -g cordova@3.6.3-0.2.13 npm ERR! fetch failed https://registry.npmjs.org/npmconf/-/npmconf-0.1.16.tgz npm ERR! fetch failed https://registry.npmjs.org/form-data/-/form-data-0.0.8.tgz npm ERR! fetch failed https://registry.npmjs.org/uglify-js/-/uglify-js-2.4.15.tg z npm ERR! fetch failed https://registry.npmjs.org/buffer/-/buffer-2.7.0.tgz npm ERR! fetch failed https://registry.npmjs.org/http-browserify/-/http-browseri fy-1.6.0.tgz npm ERR! cb() never called! npm ERR! not ok code 0 – Akinsanya Olanrewaju Feb 27 '15 at 10:19
  • even for the error `npm ERR! cb() never called!` running `sudo npm cache clean` and then reinstalling the package solved the issue for me. you can refer this [SO question](http://stackoverflow.com/questions/15393821/npm-err-cb-never-called) – Swaminathan Vetri Feb 27 '15 at 11:46
1

I had faced a similar issue. Running the command prompt as an Administrator solved my issue. Try that option as well if you have not already tried.

SankarSV4791
  • 63
  • 1
  • 1
  • 5
1

I had exactly the same issue during Cordova installation, but on Ubuntu 14.04.

sudo npm cache clean

Resolved my problem.

FeDev
  • 27
  • 3
0

For me, the version of nodejs was wrong.

I installed the older version of nodejs form here: https://nodejs.org/en/download/package-manager/

Julisch
  • 308
  • 1
  • 16
0

For me none of the above solutions worked. Then I tried this, which finally did the job :

npm uninstall -g cordova
npm install -g cordova
Flink
  • 1,008
  • 1
  • 13
  • 23
0

Here Is a ssl Error this error can be resolved using this piece of code Copy and paste this code to nodejs command promt npm set registry http://registry.npmjs.org/ 100% working Enjoy.

nafees ahmed
  • 948
  • 1
  • 12
  • 18
0

Hi Try cleaning you node cache by running

npm cache clean

then delete folder cordova.delete or cordova at the file location

 C:\Users\USER\AppData\Roaming\npm\node_modules

and then search for PowerShell in run and open it.and type

npm install -g cordova

worked for me. and please try disabling your antivirus as well.

CuriousAboutThings
  • 454
  • 2
  • 5
  • 13