10

I get the following error when I try npm install :

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs
\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v0.10.36
npm ERR! npm  v2.12.1

npm ERR! Cannot read property 'latest' of undefined
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs
\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v0.10.36
npm ERR! npm  v2.12.1

npm ERR! Cannot read property 'latest' of undefined
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs
\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v0.10.36
npm ERR! npm  v2.12.1

npm ERR! Cannot read property 'latest' of undefined
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

What is wrong? I cant use nodejs < 0.10.36 or > 0.11

josh3736
  • 139,160
  • 33
  • 216
  • 263
Smitha
  • 6,110
  • 24
  • 90
  • 161

9 Answers9

6

Change your location of cache. This will definitely work. By default NPM tries to pickup packages from cache and the default location is sometimes prohibited from reading.

npm config set cache C:\Dev\nodejs\npm-cache --global

Cheers!

Ankit Tanna
  • 1,779
  • 8
  • 32
  • 59
5

Updating npm solved the problem for me. npm install -g npm

Ankur Marwaha
  • 1,613
  • 2
  • 15
  • 30
2

You may want to point to a local registry or a registry behind the firewall

npm install --registry http://npm.myserver.com
Scott Izu
  • 2,229
  • 25
  • 12
  • 1
    Actually all of these are the right answers. Its due to multiple reasons! :) – Smitha Dec 07 '16 at 09:50
  • http://npm.myserver.com is your npm server. In many case, people build their own server and add all their dependencies there. Dependency management is commonly used by having a server repository. For example, Maven commonly uses Maven central to keep jar files for java dependencies. – Scott Izu Jul 11 '17 at 22:18
1

Culprit: Windows real time protection

Turn off the real time protection of Windows Defender (or any other anti-virus) and you will be good to go. I spent a lot of time finding this simple solution but it really works.

hhsadiq
  • 2,871
  • 1
  • 25
  • 39
1

Seems it is a certificate expire issue with:

npm registry https://registry.npmjs.org/

in stead run:

npm set registry http://registry.npmjs.org/

or else run:

npm install -g npm

This helped me!

1

Problem caused by my corporate proxy. Here is solution that worked for me: In the

"C:\Users\USERNAME"

Edit/Create

.npmrc

file with next structure:

registry=https://registry.npmjs.org/
proxy=http://192.168.10.10:1180/
https-proxy=http://192.168.10.10:1180/
strict-ssl=false

use http regitstry if https is blocked by your corporate proxy

mondayguy
  • 973
  • 2
  • 12
  • 34
0

You are probably behind a proxy or firewall. Ref. this issue.

To resolve the issue disable any firewall, proxy or antivirus that might interfere.

psv
  • 688
  • 6
  • 19
0

Check the information at the log file generated at the same folder you issued the command:

cat npm-debug.log

In my case the error was related a mistake made during typing the content of the package.json:

verbose stack Error: Invalid version: "1.0"
Ualter Jr.
  • 2,320
  • 1
  • 25
  • 28
0

This error mostly occurs when you use any defender in windows or antivirus software. I have disabled Antivirus software and work right. if a problem does not solve then start your CMD administrator mode and you should point a local registry

npm install --registry http://npm.myserver.com
vinny
  • 128
  • 1
  • 12