npm时报错npm ERR! code EPERM npm ERR! syscall mkdir npm ERR! path C:\Program Files\

554 阅读1分钟

image.png 如图,很烦。

解决方案

node.js文件 右键属性,全部更改,完全控制。 我的文件夹C:\Program Files\nodejs

image.png

(此过程还遇到一个问题,忘截图) 大概流程是 npm i -g @vue/cli 时报错 内容:有些包已过期,需要升级。 尝试各种方法均无效,最终最简单的

1、清除npm

npm cache clean (报错:npm ERR! If you're sure you want to delete the entire cache, rerun this command npm ERR! with --force.)

npm cache clean --force

降低npm版本:npm install npm@6.14.10 -g

反复在上面流程操作,如未解决。 2/3步骤

2、删除node重新安装

3、npm init -y

4、npm i -g @vue/clie 成功解决