使用npm 安装vue的时候突然报错了,找了半天只有让清缓存 终于解决

360影视 国产动漫 2025-03-25 19:01 2

摘要:使用npm 安装vue的时候突然报错了,找了半天只有让清缓存 终于解决profile-avatar心平氣和2024-01-30 13:57错误解决方法—-npm安装报错(operation not permitted, mkdir ‘C:\Program Fi

使用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 EPERM
npm ERR! syscall mkdir
npm ERR! path C:\Program Files\nodejs\node_cache_cacache
npm ERR! errno -4048
npm 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! }
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.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!

来源:心平氣和

相关推荐