network request to https://registry.npmjs.org/xxx failed, reason: connect ETIM

目录:

1、问题描述

npm install 时,报错:npm ERR! network request to https://registry.npmjs.org/postcss-pxtorem failed, reason: connect ETIMEDOU

powershell 复制代码
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! network request to https://registry.npmjs.org/postcss-pxtorem failed, reason: connect ETIMEDOUT 104.16.1.35:443
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'

2、解决方案

powershell 复制代码
//1.查看npm镜像设置
npm config get registry

//2.将npm设置为淘宝镜像
npm config set registry npm config set registry https://registry.npmmirror.com

//3.再次查看npm镜像设置
npm config get registry

3、npm镜像仓库替换

powershell 复制代码
//替换镜像的操作
1、查看当前的npm镜像设置:npm config list
2、清空缓存:npm cache clean --force
3、替换镜像地址:npm config set registry https://registry.npmmirror.com

!!!注意:此处修改的镜像用的是npm本身,一般国内用户还是建议使用淘宝镜像,所以推荐还是设置成用淘宝镜像,执行:npm config set registry https://registry.npmmirror.com 【推荐】

相关推荐
Ztiddler20 小时前
【npm设置代理-解决npm网络连接error network失败问题】
前端·后端·npm·node.js·vue
三天不学习20 小时前
前端工程化-node/npm/babel/polyfill/webpack 一文速通
前端·webpack·npm
水w1 天前
Node.js windows版本 下载和安装(详细步骤)
开发语言·前端·windows·npm·node
guokanglun2 天前
npm镜像查看和修改
前端·npm·node.js
你的代码我的心2 天前
解决 npm xxx was blocked, reason: xx bad guy, steal env and delete files
npm
明天最后2 天前
由于Two-Factor Authentication导致github发布npm包失败
前端·npm·github
平芜尽处是春山-3 天前
vue3项目执行npm install下载依赖报错问题排查方法
前端·npm·node.js
Micheal_Wayne4 天前
“无关紧要”的小知识点:“xx Packages Are Looking for Funding”——npm fund命令及运行机制
前端·npm·node.js
Anjgst4 天前
淘宝 NPM 镜像源
前端·npm·node.js
路上阡陌4 天前
pnpm : 无法加载文件 D:\Tool\environment\NodeAndNvm\node\pnpm.ps1,因为在此系统上禁止运行脚本。
vue.js·npm