我有一个npm的问题,我不能安装任何东西。以下是错误信息:

C:\Windows\system32>npm install -g yo
npm http GET https://registry.npmjs.org/yo
npm http GET https://registry.npmjs.org/yo
npm http GET https://registry.npmjs.org/yo
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! System Windows_NT 6.2.9200
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "yo"
npm ERR! cwd C:\Windows\system32
npm ERR! node -v v0.10.17
npm ERR! npm -v 1.3.8
npm ERR! syscall read
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\Windows\system32\npm-debug.log
npm ERR! not ok code 0

知道为什么吗?这是我的网络设置,似乎我没有配置任何代理。我还关闭了所有的防火墙。


当前回答

就我而言,换wifi对我来说很有用。我通常在客厅里工作。但是我几天前刚换了房间。wifi没有到达二楼,所以我们使用了wifi Extender。

然后我遇到了这个问题。我试着切换回客厅的wifi,执行同样的命令也没有问题。

其他回答

我有npm抛出这个错误的问题。

所以基本上每当抛出错误时,我要么使用手动安装 从git或等待并安装指定的版本,如:

npm install resolve@^1.1.6

独自跑步时:

npm install resolve

没有工作。

我把node.js从7更新到8,npm的安装很顺利。

我认为可能是7版本导致了这个问题,因为@luschn降级到6,所以他没有使用7。

也许注册表本身返回错误而没有在其状态页面上显示问题,因为一段时间后,我可以安装这个破坏包,然后继续使用npm install安装其余的包。

你可能还需要指定代理服务器/端口,在某些环境中,代理的系统设置不足以让npm工作。

    npm config set proxy "http://your-proxy.com:80"

我找到了一个简单的解决办法。如果你使用的是Windows 10,那么进入网络设置并关闭自动代理检测。它解决了我的问题。过去两天我一直在找这个。

use

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

所以NPM请求HTTP url而不是https。

然后试试同样的NPM安装命令

它为我解决了使用这段代码: NPM安装-g纱线

Yarn全局添加create-react-app