vue npm WARN logfile could not be created: Error: EPERM: operation not permitted
详细描述
npm 下载时提时权限不足 operation not permitted
版本信息
npm version 8.5.x
node version 16.14
复现过程
初学者初次安装node,执行npm时出现一下错误:
npm WARN logfile could not be created: Error: EPERM: operation not permitted, open 'C:\Program Files\nodejs\node_cache\_logs\2022-07-21T09_43_50_743Z-debug-0.log'
npm WARN logfile could not be created: Error: EPERM: operation not permitted, open 'C:\Program Files\nodejs\node_cache\_logs\2022-07-21T09_43_51_174Z-debug-0.log'
并且无法安装任何包
解决方案
根据报错可以知道主要时权限问题
npm WARN logfile could not be created: Error: EPERM: operation not permitted, open 'C:\Program Files\nodejs\node_cache\_logs\2022-07-21T09_43_50_743Z-debug-0.log'
根据代码提示找到nodejs文件,右键属性,选择安全,给你当前的用户组给予读写权限即可,也可以直接给到完全控制权限。
随后执行npm install .
可能会出现另一个错误
ERESOLVE unable to resolve dependency tree (无法解决依赖关系树)
npm ERR! Could not resolve dependency: (不能解决依赖关系:)
npm ERR! Fix the upstream dependency conflict, or retry(修复上游依赖冲突,或重试)
产生原因时之前的npm下载失败的缓存导致的,执行以下语句强制下载即可
npm install xxx --force 或者 npm install xxxx --legacy-peer-deps

文章有用
已有
0人
推荐该文章,推荐越多越容易获得的官方扶持