
使用npm 安装vue的时候突然报错了,找了半天只有让清缓存 终于解决profile-avatar心平氣和2024-01-30 13:57错误解决方法—-npm安装报错(operation not permitted, mkdir ‘C:\Program Files\nodejs\node_cache_cacache’)使用npm 安装vue的时候突然报错了,找了半天只有让清缓存 !终于解决!
报错如下
npm ERR! code EPERMnpm ERR! syscall mkdirnpm ERR! path C:\Program Files\nodejs\node_cache_cacachenpm ERR! errno -4048npm ERR! Error: EPERM: operation not permitted, mkdir ‘C:\Program Files\nodejs\node_cache_cacache’npm ERR! [OperationalError: EPERM: operation not permitted, mkdir ‘C:\Program Files\nodejs\node_cache_cacache’] {npm ERR! cause: [Error: EPERM: operation not permitted, mkdir ‘C:\Program Files\nodejs\node_cache_cacache’] {npm ERR! errno: -4048,npm ERR! code: ‘EPERM’,npm ERR! syscall: ‘mkdir’,npm ERR! path: ‘C:\Program Files\nodejs\node_cache\_cacache’npm ERR! },npm ERR! isOperational: true,npm ERR! errno: -4048,npm ERR! code: ‘EPERM’,npm ERR! syscall: ‘mkdir’,npm ERR! path: ‘C:\Program Files\nodejs\node_cache\_cacache’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 thenpm ERR! permissions of the file and its containing directories, or try runningnpm ERR! the command again as root/Administrator.1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.

解决方法一:.删除.npmrc文件(不建议)该文件在:C:\Users{账户}\下,一般这种类型的都是默认被隐藏,一定要选择将隐藏取消掉
如果用了方法一,确实不报错了,但是安装的路径还是会到默认路径,可以打开npmrc文件看一下里面的配置
解决方法二:在管理员的身份下执行命令清理就行,控制台输入下方命令,再执行安装即可。
npm cache clean —force
Win10怎么以管理员身份运行CMD命令提示符方法一:我们可以在Windows10系统的开始菜单上,单击鼠标右键,这时候出现的菜单中,我们选择命令提示符(管理员)点击打开这样即可。
方法二:先在Windows10系统的搜索框中直接输入命令CMD。
然后搜索结果中,还是在命令提示符上单击右键,选择管理员身份运行。

fight for future!