首页 前端知识 npm 组件库上传到npm官网报错npm ERR! network In most cases you are behind a proxy or have bad network settings.

npm 组件库上传到npm官网报错npm ERR! network In most cases you are behind a proxy or have bad network settings.

2024-06-07 23:06:11 前端知识 前端哥 101 731 我要收藏

错误1 

npm notice Publishing to https://registry.npmjs.org with tag latest and default access 
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! network request to https://registry.npmjs.org/elementplus-auto-form failed, reason: socket hang up
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.    
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! A complete log of this run can be found in: C:\Users\Administrator\AppData\Local\npm-cache\_logs\2023-10-07T07_46_28_130Z-debug-0.log

 因为之前使用的都是淘宝镜像源:

在cmd终端输入以下命令,作用是设置代理

npm config set proxy=

然后使用npm官方镜像源
npm config set registry https://registry.npmjs.org

原文链接:npm下载包时,解决报错 - 简书

错误2

设置好后又报以下错误:

npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! network request to https://registry.npmjs.org/elementplus-auto-form failed, reason: socket hang up
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.    
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! A complete log of this run can be found in: C:\Users\Administrator\AppData\Local\npm-cache\_logs\2023-10-07T07_58_42_797Z-debug-0.log

解决:

这次的提示是 failed PUT undefined, socket hangup. This is a problem related to network connectivity.

网络连接错误,socket 挂起。

查询资料后,原因是短期频繁访问 NPM 服务器。可能是同一个网络内其他同事也在发包。

解决方案:

等待若干分钟(10min),关闭代理;更换一个网络(无线网),重新 npm login ;此时 npm publish 就可以正常发布。
原文链接:https://blog.csdn.net/weixin_41697143/article/details/102843060

还是未解决。

问题解决:

1. 执行如下命令 代理置为空

npm config set proxy null 

2. 运行如下命令清理缓存

npm cache clean --force

3. 配置npm源

npm config set registry=https://registry.npmjs.org

4.再次执行npm publish

原文连接:执行npm install -g @vue/cli时报错:This is a problem related to network connectivity_青云梦尘的博客-CSDN博客

转载请注明出处或者链接地址:https://www.qianduange.cn//article/11369.html
标签
评论
发布的文章

echarts 鼠标划过显示信息

2024-06-14 23:06:40

echarts@5 动画失效

2024-06-14 23:06:39

vue3 聊天机器人 聊天界面

2024-06-14 23:06:06

Vue - Vue3 集成编辑器功能

2024-06-14 23:06:54

大家推荐的文章
会员中心 联系我 留言建议 回顶部
复制成功!