npm install 以后一直因为网络原因不能正常下载依赖

问题描述

PS C:\Users\24552\Desktop\上云apiV2版本源码\Cloud-API-Demo-Web> npm install
npm ERR! code ENOTFOUND
npm ERR! syscall getaddrinfo
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.nlark.com/vue-cookies/download/vue-cookies-1.7.4.tgz failed, reason: getaddrinfo ENOTFOUND registry.nlark.com
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'

npm ERR! A complete log of this run can be found in: C:\Program Files\nodejs\node_cache\_logs\2024-09-02T02_48_51_326Z-debug-0.log
每次npm install 都卡在ant-design-vue: timing reifyNode:node_modules/@ant-design/icons-svg

解决思路:

如果每次运行 npm install 时都会卡在 ant-design-vue 相关的 @ant-design/icons-svg 包上,可能是由于以下原因:

1. 依赖包冲突或损坏
清理 npm 缓存:有时候缓存文件可能损坏,导致安装过程中出现问题。可以尝试清理 npm 缓存:
bash
复制代码
npm cache clean --force
删除 node_modules 和 package-lock.json:然后重新安装依赖:
bash
复制代码
rm -rf node_modules package-lock.json
npm install
2. 网络问题
切换 npm registry:如果你使用了镜像源,可能是该源的问题,尝试切换回官方 npm 源:
bash
复制代码
npm config set registry https://registry.npmjs.org/
使用 npm install 的 --verbose 选项:可以看到详细的日志信息,以便更好地了解卡住的原因:
bash
复制代码
npm install --verbose
3. Node.js 版本
检查 Node.js 版本:确保你的 Node.js 版本是最新的稳定版。可以使用 nvm 来管理和切换 Node.js 版本:
bash
复制代码
node -v
nvm install stable
nvm use stable
4. 尝试单独安装问题依赖
如果问题依旧存在,可以尝试单独安装 @ant-design/icons-svg 依赖,看看是否能正常安装:
bash
复制代码
npm install @ant-design/icons-svg
5. 使用 Yarn 代替 npm
如果 npm install 依旧有问题,可以尝试使用 Yarn 作为包管理器:
bash
复制代码
npm install -g yarn
yarn install
这些步骤应该能够帮助你解决在安装 ant-design-vue 时遇到的问题。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值