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

相关推荐
l1o3v1e4ding1 天前
windows安装Claude Code,并接入Deepseek-v4模型 ,提供离线安装包
git·npm·node.js·claude code·cc-switchcc
TT_Close2 天前
别再复制旧 Flutter 工程了,真正拖慢你的不是业务代码
flutter·npm·visual studio code
Penfy_Z2 天前
【Python LLM 调用踩坑】Connection error 终极解决方案!npm 代理导致阿里云通义千问接口连接失败
开发语言·python·npm
终将老去的穷苦程序员2 天前
npm : 无法加载文件 C:\Program Files\nodejs\npm.ps1,因为在此系统上禁止运行脚
前端·npm·node.js
之歆3 天前
Node.js 与 NPM 包管理完全指南
前端·npm·node.js
12点一刻3 天前
npx 使用入门教程:是什么、怎么用、和 npm 有什么区别
前端·npm·node.js
cv魔法师4 天前
解决vscode终端报错npm : 无法加载文件npm.ps1,因为在此系统上禁止运行脚本。
ide·vscode·npm
夜雪闻竹6 天前
版本管理:npm 发布 + Electron 打包 + CI/CD
ci/cd·npm·node.js·代码规范·chatcrystal
zhangfeng11337 天前
workbuddy ,node.js 每次会在 项目目录上安装 node_modules,能不能一次安装多次使用,为什么 npm 不把包装在全局
前端·npm·node.js
步十人7 天前
【Vue3】前置知识简单概述(包括ES6核心语法,模块化ESM以及npm基础)
arcgis·npm·vue·es6