45

I was trying to instal Ionic framework in my Windows 8 system and was trying to install Cordova first.

I'm getting this error while trying to install Cordova, that says

Your environment has been set up for using Node.js 0.12.4 (x64) and npm.

C:\Users\Sworup>npm install -g cordova ionic
npm ERR! registry error parsing json
npm ERR! tar.unpack untar error C:\Users\Sworup\AppData\Local\Temp\npm-1424-df7f
43fe\registry.npmjs.org\underscore\-\underscore-1.7.0.tgz
npm ERR! tar.unpack untar error C:\Users\Sworup\AppData\Local\Temp\npm-1424-df7f
43fe\registry.npmjs.org\npm\-\npm-2.1.3.tgz
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" "ionic"
npm ERR! node v0.12.4
npm ERR! npm  v2.10.1
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! syscall read

npm ERR! network read ECONNRESET
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settin
gs.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'
npm ERR! tar.unpack untar error C:\Users\Sworup\AppData\Local\Temp\npm-1424-df7f
43fe\registry.npmjs.org\prompt\-\prompt-0.2.12.tgz
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" "ionic"
npm ERR! node v0.12.4
npm ERR! npm  v2.10.1

npm ERR! unexpected eof
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

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

C:\Users\Sworup>

My system configuration is as follows:

C:\Windows\System32>npm -v
2.10.1

C:\Windows\System32>node -v
v0.12.4

C:\Windows\System32>git --version
git version 1.9.4.msysgit.1

I already did

C:\Windows\System32>npm cache clear

before running the install command to no use.

I tried changing the registry to http still no use.

I tried installing Ionic framework separately, still no luck.

I tried installing Phonegap, same errors as above.

I'm just stuck at this point and have no idea what to do.

Sworup Shakya
  • 1,328
  • 3
  • 16
  • 44
  • update node js to latest version [http://askubuntu.com/questions/426750/how-can-i-update-my-nodejs-to-the-latest-version](http://askubuntu.com/questions/426750/how-can-i-update-my-nodejs-to-the-latest-version) – Haseena P A Nov 07 '16 at 12:33

12 Answers12

92

In my case, I had a very old version of npm. Upgrading npm using sudo npm install npm -g fixed the problem for me. Additionally I also did rm -rf node_modules and npm cache clean and npm config set registry "http://registry.npmjs.org/"

sdm
  • 1,236
  • 11
  • 9
  • 4
    Great. I had to use `sudo npm cache clean` followed by `sudo npm install npm -g` – Scott Apr 05 '16 at 16:13
  • 2
    npm config set registry "http://registry.npmjs.org/" < is helpful without knowing issue.. – Kim Apr 14 '16 at 06:35
20

I had similar problem. I rаn npm cache clear, closed android SDK manager(which was open before) and re-ran npm install -g cordova and that was enough to solve the problem.

Bojan Trajkovski
  • 1,056
  • 1
  • 15
  • 31
  • 1
    npm cache clear is not working for some reason. But just now the installation worked in one of my colleague's system. I'll try it again in a while. – Sworup Shakya Jun 18 '15 at 11:38
9
npm config set registry "http://registry.npmjs.org"

Solved the issue for me. Note that it wouldn't accecpt a forward slash at the end of the url and it had to be entered exactly as shown above.

Fredrik_Borgstrom
  • 2,504
  • 25
  • 32
  • Thank you !, this worked for me, as I had setted it to "http://registry.npmjs.eu/" an this server is down. So I didn't figure out, this was the reason. – another Jul 11 '17 at 13:37
4

first I had to delete my registry by using npm config delete registry and register new value using npm config set registry "http://registry.npmjs.org"

2

In my case all Internet access must run through a proxy and npm was not configured with the proxy to reach http://registry.npmjs.org.

I ran npm install --log-level verbose to get more information and saw that the response had HTML stating I was not authenticated with the proxy.

Running the following fixed it (replacing below with your username/password/proxy address:

npm config set proxy 'username:password@your.proxy.com'
npm config set https-proxy 'username:password@your.proxy.com'

I do not advise putting the password in raw text instead using something like cntlm to set up a local proxy that delegates to the real proxy.

dukethrash
  • 1,449
  • 4
  • 15
  • 25
1

I had this same problem when trying to upgrade pm2 to the latest version.

Thanks to sdm's answer I did npm update npm -g and it did the trick for me.

1

npm install -g @angular/cli --registry http://registry.npmjs.org/ worked for me

1

For me following fixed the issue:

  1. npm cache clear
  2. Made sure that NPM & Git proxies are set properly

In this case Git proxy may not be required.

Abhishek Dhote
  • 1,638
  • 10
  • 41
  • 62
0

My npm install worked fine, but I had this problem with npm update. To fix it, I had to run npm cache clean and then npm cache clear.

cjbarth
  • 4,189
  • 6
  • 43
  • 62
0

I had the same issue and the following fixed my issue:

  1. Set the registry: npm config set registry "http://registry.npmjs.org/"
  2. Removed the entry in hosts file (using Windows 7) => C:\Windows\System32\drivers\etc\hosts
0

In my case artifactory was down. npm install command is throwing below error.

npm ERR! registry error parsing json

  • This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. – Johan May 03 '19 at 08:31
-1

pls remove the

HTTP_PROXY HTTPS_PROXY proxy from the npmrc file