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

相关推荐
孟孟~4 小时前
npm run dev 报错:Error: error:0308010C:digital envelope routines::unsupported
前端·npm·node.js
孟孟~4 小时前
npm install 报错:npm error: ...node_modules\deasync npm error command failed
前端·npm·node.js
程序猿小D12 小时前
第14节 Node.js 全局对象
linux·前端·npm·node.js·编辑器·vim
Jadon_z1 天前
vue2 项目中 npm run dev 运行98% after emitting CopyPlugin 卡死
前端·npm
行走的生活1 天前
vscode中无法使用npm node
ide·vscode·npm
早知道不学Java了1 天前
chromedriver 下载失败
前端·vue.js·react.js·npm·node.js
盼儿哥1 天前
123网盘SDK-npm包已发布
前端·npm·node.js
打破砂锅问到底0072 天前
前端验证下跨域问题(npm验证)
前端·npm·node.js
你真会2 天前
【Node.js 深度解析】npm install 遭遇:npm ERR! code CERT_HAS_EXPIRED 错误的终极解决方案
前端·npm·node.js
程序猿小D3 天前
第4节 Node.js NPM 使用介绍
服务器·前端·vscode·npm·node.js