mac安装vue3成功步骤

第一步:参考:Mac 安装 vue3 环境_mac 安装vue-CSDN博客

第二步:报错执行:sudo npm install -g @vue/cli 报错:npm error code EEXIST

npm error path /usr/local/bin/vue

npm error EEXIST: file already exists

npm error File exists: /usr/local/bin/vue

npm error Remove the existing file and try again, or run npm

npm error with --force to overwrite files recklessly.

npm error A complete log of this run can be found in: /Users/kevnwang/.npm/_logs/2024-08-26T08_17_51_227Z-debug-0.log

解决方法:

在终端中执行以下命令:sudo rm /usr/local/bin/vue

第三步:执行:vue create my-project 报错如下:

npm error code EACCES

npm error syscall open

npm error path /Users/kevnwang/.npm/_cacache/index-v5/15/40/0ebcbd9ca76d672114d6e06dd5204999f3fd585e151ee938026539f7b335

npm error errno EACCES

npm error

npm error Your cache folder contains root-owned files, due to a bug in

npm error previous versions of npm which has since been addressed.

npm error

npm error To permanently fix this problem, please run:

npm error sudo chown -R 501:20 "/Users/kevnwang/.npm"

npm error A complete log of this run can be found in: /Users/kevnwang/.npm/_logs/2024-08-26T08_34_12_573Z-debug-0.log

ERROR Error: command failed: npm install --loglevel error --legacy-peer-deps

Error: command failed: npm install --loglevel error --legacy-peer-deps

at ChildProcess.<anonymous> (/usr/local/lib/node_modules/@vue/cli/lib/util/executeCommand.js:138:16)

at ChildProcess.emit (node:events:520:28)

at maybeClose (node:internal/child_process:1105:16)

at ChildProcess._handle.onexit (node:internal/child_process:305:5)

解决方法:

执行:sudo chown -R 501:20 "/Users/kevnwang/.npm"

相关推荐
pas1367 分钟前
40-mini-vue 实现三种联合类型
前端·javascript·vue.js
摇滚侠15 分钟前
2 小时快速入门 ES6 基础视频教程
前端·ecmascript·es6
珑墨1 小时前
【Turbo】使用介绍
前端
军军君011 小时前
Three.js基础功能学习十三:太阳系实例上
前端·javascript·vue.js·学习·3d·前端框架·three
打小就很皮...3 小时前
Tesseract.js OCR 中文识别
前端·react.js·ocr
wuhen_n3 小时前
JavaScript内存管理与执行上下文
前端·javascript
Hi_kenyon3 小时前
理解vue中的ref
前端·javascript·vue.js
落霞的思绪5 小时前
配置React和React-dom为CDN引入
前端·react.js·前端框架
Hacker_Z&Q5 小时前
CSS 笔记2 (属性)
前端·css·笔记
Anastasiozzzz5 小时前
LeetCode Hot100 295. 数据流的中位数 MedianFinder
java·服务器·前端