解决npm异常npm WARN logfile could not be created: Error: EPERM: operation not permitted

报错:npm WARN logfile could not be created: Error: EPERM: operation not permitted, open 'C:\Program Files\nodejs\node_cache\_logs\2022-07-02T06_04_13_931Z-debug-0.log'

1.是因为你使用的命令行不是用管理员进行打开使用,会进行报错;

这里使用管理员模式打开命令行,不会进行报错了!

2.每次使用管理员模式打开闲麻烦,就是文件没权限,可在你安装的目录下,进行操作

忘记nodejs安装在哪,使用命令进行查看

where node

进入到目录下,右键选择目录,点击属性,再次点击安全,选择用户,点击下面的权限,点击应用

解决npm异常npm WARN logfile could not be created: Error: EPERM: operation not permitted_第1张图片

 解决npm异常npm WARN logfile could not be created: Error: EPERM: operation not permitted_第2张图片

设置完之后,就不会报错了,我这里比较懒,全部设置的,可单独只设置两个文件就可以了。

 将文件夹 node_cache和node_global赋予权限就可以了。

你可能感兴趣的:(Tools-Solve,npm,node.js)