node.js Npm 错误 - Windows NT - 如何解决

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32965938/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 19:21:39  来源:igfitidea点击:

Npm Error - Windows NT - How to resolve

node.jsnpm

提问by Smitha

I get the following error when I try npm install :

尝试 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

怎么了?我不能使用 nodejs < 0.10.36 或 > 0.11

采纳答案by Scott Izu

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

您可能希望指向本地注册表或防火墙后面的注册表

npm install --registry http://npm.myserver.com

回答by Ankit Tanna

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 会尝试从缓存中提取包,并且有时会禁止读取默认位置。

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

npm 配置集缓存 C:\Dev\nodejs\npm-cache --global

Cheers!

干杯!

回答by Ankur Marwaha

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

更新 npm 为我解决了这个问题。 npm install -g npm

回答by Harendra Kr. Jadon

Seems it is a certificate expire issue with:

似乎是证书过期问题:

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

npm 注册表https://registry.npmjs.org/

in stead run:

而是运行:

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

npm 设置注册表http://registry.npmjs.org/

or else run:

否则运行:

npm install -g npm

npm install -g npm

This helped me!

这对我有帮助!

回答by mondayguy

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

由我的公司代理引起的问题。这是对我有用的解决方案:在

"C:\Users\USERNAME"

“C:\用户\用户名”

Edit/Create

编辑/创建

.npmrc

.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 regitstryif https is blocked by your corporate proxy

如果 https 被您的公司代理阻止,请使用 http 注册

回答by hhsadiq

Culprit: Windows real time protection

罪魁祸首:Windows 实时保护

Turn off the real time protectionof 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.

关闭Windows Defender(或任何其他防病毒软件)的实时保护,您就可以开始使用了。我花了很多时间找到这个简单的解决方案,但它确实有效。

回答by petersv

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

您可能位于代理或防火墙后面。参考 这个问题

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

要解决此问题,请禁用任何可能会干扰的防火墙、代理或防病毒软件。

回答by Ualter Jr.

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:

在我的情况下,错误与键入 package.json 的内容时犯的错误有关:

verbose stack Error: Invalid version: "1.0"

回答by vinny

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

当您在 Windows 或防病毒软件中使用任何防御者时,通常会发生此错误。我已禁用防病毒软件并正常工作。如果问题没有解决,那么启动你的 CMD 管理员模式,你应该指向一个本地注册表

npm install --registry http://npm.myserver.com