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

解决下载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

这样就安装成功了

 

 

 


http://www.kler.cn/a/592654.html

相关文章:

  • JAVA并发-volatile底层原理
  • opencv初步学习——图像处理2
  • Day67 | 灵神 | 二分查找:统计公平数对的数目
  • SQLMesh系列教程:SQLMesh虚拟数据环境
  • 台式机电脑组装---电源
  • 【C++】STL(1) - 序列容器
  • Java设计模式之模板方法模式(Template Method Pattern)
  • Redis 三主三从集群部署的完整方案
  • ASP3605同步降压调节器——满足汽车电子严苛要求的电源芯片方案
  • 进程间通信(1)——管道
  • 数据结构知识点1
  • excel文件有两列,循环读取文件两列赋值到字典列表。字典的有两个key,分别为question和answer。将最终结果输出到json文件
  • 使用STM32CubeMX+DMA+空闲中断实现串口接收和发送数据(STM32G070CBT6)
  • 【开源宝藏】30天学会CSS - DAY3 第三课 滑动文本+变色
  • mysql 索引的使用
  • mapbox-gl源码中解析style加载地图过程详解
  • 线性规划的标准形式
  • Golang开发
  • 【Dive Into Stable Diffusion v3.5】1:开源项目正式发布——深入探索SDv3.5模型全参/LoRA/RLHF训练
  • 使用 Wireshark 在 Ubuntu 22.04 上抓包分析网络流量