我的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

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

在此处输入图像描述

推荐答案

使用

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

所以npm请求http个url,而不是https个.

然后try 同样的npm install命令

Node.js相关问答推荐

如何从puppeteer的page. evaluate()中获取流数据?(node.js)

如何将信号从终端窗口发送到运行在Raspberry Pi上的Puppeteer/Node.js上的webscraper

使用HTTPS从NodeJS 17.9.1升级到18.0.0后,SignalR连接失败

购物车是空的状态|本地存储不更新产品数量|Redux|

使用ReadableStream.管道时NodeJS Crypto Hash不正确

如何使用Nextjs路由从下一步/导航在新选项卡中通过";router.ush";打开链接

在对象的嵌套数组中使用$lookup,创建多个记录作为响应,mongodb

DynamoDB 分页数据检索

在父模式中设置默认值.

表达 js 错误处理程序在第一个之后被忽略

当try 将 formData 转换为 express js 时,服务器无法识别 multipart/form-data

级联定时器和Jest 的异步功能

如何在 MongoDB collection.find() 上获取回调

在本地运行 Cloud Functions 会出现错误functions.config() 不可用

我可以向NPM添加调试脚本吗?

如何在 Node.js 中使用 chmod

如何从 findOneAndUpdate 方法中获取更新的文档?

如何让 Mocha 加载定义全局挂钩或实用程序的 helper.js 文件?

node.js 示例

从 node.js 连接到 mongodb 时出现 ECONNREFUSED 错误