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"

相关推荐
pepedd8641 分钟前
全面解析this-理解this指向的原理
前端·javascript·trae
渔夫正在掘金1 分钟前
神奇魔法类:使用 createMagicClass 增强你的 JavaScript/Typescript 类
前端·javascript
雲墨款哥2 分钟前
一个前端开发者的救赎之路-JS基础回顾(三)-Function函数
前端·javascript
猩猩程序员3 分钟前
NAPI-RS v3:优化 Rust 与 前端 Node.js 跨平台支持
前端
艾小码3 分钟前
CSS粘性定位失效?深度解析 position: sticky 的陷阱与解决方案
前端·css
小徐_23334 分钟前
Trae 辅助下的 uni-app 跨端小程序工程化开发实践分享
前端·uni-app·trae
汪子熙5 分钟前
深入理解 TypeScript 的 /// <reference /> 注释及其用途
前端·javascript
全栈老石5 分钟前
设计师到前端不再有墙:Figma + VS Code 自动出码实践
前端·vue.js·html
GIS之路6 分钟前
GeoTools 结合 OpenLayers 实现叠加分析
前端
Nexmoe7 分钟前
前端新手常踩的坑:方法一改全站崩
前端