无法安装 Vue CLI?(苹果系统) [英] Can't install Vue CLI? (MacOS)

查看:58
本文介绍了无法安装 Vue CLI?(苹果系统)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,我正在尝试通过 npm (sudo npm install -g @vue/cli) 安装 Vue,但我收到了一堆警告和错误,我真的说不通不知道为什么会发生...

<块引用>

npm WARN deprecated request@2.88.2:request 已被弃用,参见 [`https://github.com/request/request/issues/3142`](https://github.com/request/request/issues/3142)npm WARN 已弃用 resolve-url@0.2.1: [`https://github.com/lydell/resolve-url#deprecated`](https://github.com/lydell/resolve-url#deprecated)npm WARN 已弃用 urix@0.1.0:请参阅 [`https://github.com/lydell/urix#deprecated`](https://github.com/lydell/urix#deprecated)npm WARN 已弃用 chokidar@2.1.8:Chokidar 2 将在节点 v14+ 上中断.升级到 chokidar 3,依赖项减少 15 倍.npm WARN 已弃用 fsevents@1.2.13:fsevents 1 将在节点 v14+ 上中断,并且可能使用不安全的二进制文件.升级到 fsevents 2./usr/local/bin/vue ->/usr/local/lib/node_modules/@vue/cli/bin/vue.js>fsevents@1.2.13 安装/usr/local/lib/node_modules/@vue/cli/node_modules/fsevents`>节点安装.jsgyp WARN EACCES 当前用户(nobody")无权访问开发目录/Users/jamesecroyd/Library/Caches/node-gyp/12.18.0";gyp WARN EACCES 尝试使用临时开发目录/usr/local/lib/node_modules/@vue/cli/node_modules/fsevents/.node-gyp"重新安装gyp WARN 安装出错,回滚安装gyp WARN 安装出错,回滚安装吉普错误!配置错误吉普错误!堆栈错误:EACCES:权限被拒绝,mkdir '/usr/local/lib/node_modules/@vue/cli/node_modules/fsevents/.node-gyp'吉普错误!系统达尔文 18.7.0吉普错误!命令/usr/local/bin/node"/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js"重建"吉普错误!cwd/usr/local/lib/node_modules/@vue/cli/node_modules/fsevents吉普错误!节点 -v v12.18.0吉普错误!节点-gyp -v v5.1.0吉普错误!不好

有人知道为什么会这样吗?我已经多次安装和卸载Vue,没有运气...

解决方案

使用 NPM 的 <代码>--unsafe-perm 标志:

sudo npm install -g @vue/cli --unsafe-perm

或者切换到 Node 版本管理器(例如,nvmn),避免了这些问题.

Hey so I'm trying to install Vue via npm (sudo npm install -g @vue/cli) and I just get a bunch of warnings and errors and I can't really make sense of it and have no idea why its happening...

npm WARN deprecated request@2.88.2: request has been deprecated, see [`https://github.com/request/request/issues/3142`](https://github.com/request/request/issues/3142)
npm WARN deprecated resolve-url@0.2.1: [`https://github.com/lydell/resolve-url#deprecated`](https://github.com/lydell/resolve-url#deprecated)
npm WARN deprecated urix@0.1.0: Please see [`https://github.com/lydell/urix#deprecated`](https://github.com/lydell/urix#deprecated)
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.

/usr/local/bin/vue -> /usr/local/lib/node_modules/@vue/cli/bin/vue.js
> fsevents@1.2.13 install /usr/local/lib/node_modules/@vue/cli/node_modules/fsevents`
> node install.js
gyp WARN EACCES current user ("nobody") does not have permission to access the dev dir "/Users/jamesecroyd/Library/Caches/node-gyp/12.18.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/@vue/cli/node_modules/fsevents/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@vue/cli/node_modules/fsevents/.node-gyp'
gyp ERR! System Darwin 18.7.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/@vue/cli/node_modules/fsevents
gyp ERR! node -v v12.18.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok

Anyone have any idea why this is happening? I have installed and uninstalled Vue multiple times, no luck...

解决方案

Use NPM's --unsafe-perm flag:

sudo npm install -g @vue/cli --unsafe-perm

Or switch to a Node version manager (e.g., nvm or n), which avoids these issues.

这篇关于无法安装 Vue CLI?(苹果系统)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆