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 【推荐】

相关推荐
吴敬悦11 小时前
私有的 GitHub Package 怎么拉取?
npm·github
前端郭德纲19 小时前
React 19.2 已发布,现已上线 npm!
前端·react.js·npm
LYFlied20 小时前
【一句话概括】前端项目包管理器怎么选?
前端·npm·pnpm·yarn
LisEcho2 天前
yoyoj-rn — RN 的脚手架工具可以不是 @react-native-community/cli
前端·react native·npm
醉风塘2 天前
NPM:从“模块之痛”到“生态之基”的演化史
前端·npm·node.js
水冗水孚2 天前
通俗易懂地谈谈,前端工程化之自定义脚手架的理解,并附上一个实践案例发布到npm上
javascript·npm·node.js
蚂蚁不吃土&2 天前
cmd powershell svm nodejs npm
前端·npm·node.js
Lucky_Turtle3 天前
【Node】npm install报错npm error Cannot read properties of null (reading ‘matches‘)
前端·npm·node.js
水冗水孚3 天前
20张图的保姆级教程,记录使用Verdaccio在Ubuntu服务器上搭建Npm私服
npm
Irene19914 天前
npm 完整生命周期脚本及特点
npm·生命周期