【问题记录】npm create vue@latest报错

1,错误日志

复制代码
npm error code EPERM
npm error syscall mkdir
npm error path D:\Program Files\nodejs\node_cache\_cacache
npm error errno EPERM
npm error FetchError: Invalid response body while trying to fetch https://registry.npmjs.org/create-vue: EPERM: operation not permitted, mkdir 'D:\Program Files\nodejs\node_cache\_cacache'
npm error     at D:\Program Files\nodejs\node_modules\npm\node_modules\minipass-fetch\lib\body.js:170:15
npm error     at async Response.json (D:\Program Files\nodejs\node_modules\npm\node_modules\minipass-fetch\lib\body.js:75:17)
npm error     at async RegistryFetcher.packument (D:\Program Files\nodejs\node_modules\npm\node_modules\pacote\lib\registry.js:98:25)
npm error     at async RegistryFetcher.manifest (D:\Program Files\nodejs\node_modules\npm\node_modules\pacote\lib\registry.js:128:23)
npm error     at async getManifest (D:\Program Files\nodejs\node_modules\npm\node_modules\libnpmexec\lib\index.js:27:22)
npm error     at async missingFromTree (D:\Program Files\nodejs\node_modules\npm\node_modules\libnpmexec\lib\index.js:65:22)
npm error     at async D:\Program Files\nodejs\node_modules\npm\node_modules\libnpmexec\lib\index.js:182:32
npm error     at async Promise.all (index 0)
npm error     at async exec (D:\Program Files\nodejs\node_modules\npm\node_modules\libnpmexec\lib\index.js:180:3)
npm error     at async Init.execCreate (D:\Program Files\nodejs\node_modules\npm\lib\commands\init.js:135:5) {
npm error   code: 'EPERM',
npm error   errno: 'EPERM',
npm error   syscall: 'mkdir',
npm error   path: 'D:\\Program Files\\nodejs\\node_cache\\_cacache',
npm error   type: 'system'
npm error }
npm error
npm error The operation was rejected by your operating system.
npm error It's possible that the file was already in use (by a text editor or antivirus),
npm error or that you lack permissions to access it.
npm error
npm error If you believe this might be a permissions issue, please double-check the
npm error permissions of the file and its containing directories, or try running
npm error the command again as root/Administrator.
npm error Log files were not written due to an error writing to the directory: D:\Program Files\nodejs\node_cache\_logs
npm error You can rerun the command with `--loglevel=verbose` to see the logs in your terminal

2,错误原因

没有管理员权限,无法在node_globalnode_cache两个文件夹下进行操作

3,解决办法

修改node_globalnode_cache文件夹的权限

1,右键文件夹-->属性-->安全

2,点击编辑-->在允许栏全部勾上-->确认-->确认

将两个文件夹的权限都修改后就不会报错。

相关推荐
鱼樱前端1 小时前
今天介绍下最新更新的Vite7
前端·vue.js
coder_pig2 小时前
跟🤡杰哥一起学Flutter (三十四、玩转Flutter手势✋)
前端·flutter·harmonyos
万少2 小时前
01-自然壁纸实战教程-免费开放啦
前端
独立开阀者_FwtCoder2 小时前
【Augment】 Augment技巧之 Rewrite Prompt(重写提示) 有神奇的魔法
前端·javascript·github
yuki_uix2 小时前
AI辅助网页设计:从图片到代码的实践探索
前端
我想说一句2 小时前
事件机制与委托:从冒泡捕获到高效编程的奇妙之旅
前端·javascript
陈随易2 小时前
MoonBit助力前端开发,加密&性能两不误,斐波那契测试提高3-4倍
前端·后端·程序员
小飞悟2 小时前
你以为 React 的事件很简单?错了,它暗藏玄机!
前端·javascript·面试
中微子2 小时前
JavaScript 事件机制:捕获、冒泡与事件委托详解
前端·javascript
Whoisshutiao3 小时前
网安-XSS-pikachu
前端·安全·网络安全