当前位置: 首页 > news >正文

解决下载npm 缓存出现的问题

因为这几天一直在写项目,然后刚开始进行部署的时候遇到了一些问题,比如node版本问题,和npm缓存问题...还有element plus资源更新使用等问题,现在和大家分享一下我是如何解决的,希望对大家以后写项目的时候会有写帮助

当我们进行多人合作的时候,我们需要不停的合并我们的代码,并且再获得一个新代码的编写,这个时候我们就需要进行一个新的npm缓存,因为node_module文件是在我们本地的,不会从远程拉过来,所以我们需要重新下载npm缓存

类似这种情况就是依赖缓存没有下载完全  有关node_module

但是每次在我的本地文件夹终端每次进行进行npm缓存更新的时候,就会报这种错误。

PS D:\system-manager\study-group-manager-web> npm i  
npm warn ERESOLVE overriding peer dependency
npm warn While resolving: stylelint-config-recommended@15.0.0
npm warn Found: stylelint@14.16.1
npm warn node_modules/stylelint
npm warn   dev stylelint@"^14.13.0" from the root project
npm warn   6 more (stylelint-config-html, stylelint-config-prettier, ...)
.........................(省略)
npm warn Could not resolve dependency:
npm warn peer stylelint@"^16.13.0" from the root project
npm error code ETIMEDOUT
npm error syscall connect
npm error errno ETIMEDOUT
npm error network request to https://registry.npmmirror.com/stylelint failed, reason: connect ETIMEDOUT 2408:8719:3000:5:3::3fa:443
npm error network This is a problem related to network connectivity.
npm error network In most cases you are behind a proxy or have bad network settings.
npm error network
npm error network If you are behind a proxy, please make sure that the
npm error network 'proxy' config is set properly.  See: 'npm help config'
npm error Log files were not written due to an error writing to the directory: D:\mysoftware\node_cache\_logs
npm error You can rerun the command with `--loglevel=verbose` to see the logs in your terminal

可能出现的问题:

1. **权限不足**:当前用户对目标目录没有写入权限。

2. **文件被占用**:目录或文件可能被其他程序(如文本编辑器、IDE、杀毒软件)锁定。

3. **缓存问题**:npm的缓存目录可能存在损坏或权限问题。

4. **版本问题**...等

之前我遇到这种报错的时候,不知道怎么改,就一直问AI如何解决这种问题,但是几番试下来还是没有解决,虽然AI给了我很多解决方案,但是那这种我使用下来还是没能解决我的问题,反而有点越走越偏的感觉,下面是我的解决方法:

右键点击电脑->然后点击终端管理员

通过cd进入到自己的项目文件夹

 配置淘宝镜像:npm config set registry https://registry.npmmirror.com/

 清除缓存:

# 1. 清理缓存和旧依赖
npm cache clean --force
rm -rf node_modules package-lock.json

这样就安装成功了

 

 

 

相关文章:

  • 【Redis】缓存穿透、缓存击穿、缓存雪崩
  • 【前缀和的力量:高效解决子数组和矩阵问题的秘笈】—— 蓝桥杯高频热点题型知识点
  • 向量数据库技术系列一-基本原理
  • rk3568 phy驱动调式_phy寄存器
  • Linux---用户组
  • 精选一百道备赛蓝桥杯——4.冶炼金属
  • SpringMVC-文件上传
  • 游戏引擎学习第163天
  • Codeforces Round 986 (Div. 2)
  • leetcode日记(99)不同的子序列
  • 感受命令行界面的魅力——Linux环境下基础开发工具的使用
  • Leetcode-132.Palindrome Partitioning II [C++][Java]
  • 如何在PyCharm中利用Python对象自动提示提高开发效率?
  • 数学建模 第二节
  • 删除二叉搜索树中的节点
  • 第五章-动态规划
  • 实践 PyTorch 手写数字识别
  • 机试准备第17天
  • Suno的对手Luno:AI音乐开发「上传参考音频 - 方式一:通过二进制流的方式」 —— 「Luno Api系列|AI音乐API」第11篇
  • 【NLP 38、实践 ⑩ NER 命名实体识别任务 Bert 实现】
  • 广西百色通报:极端强对流天气致墙体倒塌,3人遇难7人受伤
  • 外卖员投资失败负疚离家流浪,经民警劝回后泣不成声给父母下跪
  • 国防部:奉劝有关国家不要引狼入室,甘当棋子
  • 2025江西跨境电子商务发展交流会召开,探索行业发展新趋势
  • 公募基金解读“一揽子金融政策”:增量财政空间或打开,有助于维持A股活力
  • 上海:下调个人住房公积金贷款利率