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

相关推荐
墨菲安全8 小时前
NPM组件 betsson 等窃取主机敏感信息
前端·npm·node.js·软件供应链安全·主机信息窃取·npm组件投毒
聪聪的学习笔记21 小时前
【1】确认安装 Node.js 和 npm版本号
前端·npm·node.js
whale fall2 天前
npm install安装不成功(node:32388)怎么解决?
前端·npm·node.js
Gazer_S2 天前
【公司环境下发布个人NPM包完整教程】
前端·npm·node.js
溪i2 天前
pnpm 升级
npm
你喜欢喝可乐吗?2 天前
Windows 安装 nodejs npm
前端·npm·node.js
come112342 天前
npm 命令入门指南(前端小白版)
前端·npm·node.js
墨菲安全2 天前
NPM组件 alan-baileys 等窃取主机敏感信息
前端·npm·node.js·npm组件·恶意包·主机信息窃取
我在北京coding2 天前
npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree
前端·npm·node.js
whale fall2 天前
npm代理设置 + npm配置镜像源
前端·npm·node.js