今天查看了项目的node_modules文件,有2.78G,好家伙,占用空间有点大,然后就删掉了node_modules和package–lock.json文件,重新执行npm install
,然后就报错了,之前记得有这样做过,也没有报错呀,离大谱
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'rename',
npm ERR! dest: 'D:\XXXXXproject\oss\node_modules\compression-webpack-plugin\package.json'
npm ERR! },
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! path: 'D:\XXXXX\project\oss\node_modules\compression-webpack-plugin\package.json.3700355834',
npm ERR! dest: 'D:\XXXXX\project\oss\node_modules\compression-webpack-plugin\package.json',
npm ERR! parent: 'oss'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! C:Program Filesnodejsnode_cache_logs2023-01-12T05_18_52_549Z-debug.log
刚开始以为是自己node.js环境变量没配置好,重新检查了一遍,少了这些配置
然后重新下载依赖包,发现还是不行,网上解决方案挺多,但总有不适合自己项目的
清除缓存:
Cache verified and compressed (C:Program Filesnodejsnode_cache_cacache):
Content verified: 4661 (496839341 bytes)
Index entries: 7125
Finished in 4.26s
接着再试试别的方法,找到了一个播客是下载的时候后面加上了淘宝镜像
完美解决,虽然不知道前面的检查有没有影响,但好歹项目可以正常运行,node_moudels文件也没有那么大了,恢复到了几百兆
原文地址:https://blog.csdn.net/weixin_59769277/article/details/128658298
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.7code.cn/show_19904.html
如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱:suwngjj01@126.com进行投诉反馈,一经查实,立即删除!
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。