node.js - 无法安装 Vue CLI? (苹果系统)

标签 node.js vue.js npm terminal vuejs2

嘿,所以我正在尝试通过 npm (sudo npm install -g @vue/cli) 安装 Vue,我只是收到一堆警告和错误,我真的无法理解并且不知道为什么会发生...

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

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

最佳答案

使用 NPM 的 --unsafe-perm标志:

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

或者切换到 Node 版本管理器(例如 nvmn ),这样可以避免这些问题。

关于node.js - 无法安装 Vue CLI? (苹果系统),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62494949/

相关文章:

node.js - 给定访问 token 和刷新 token ,如何获取 google+ 用户个人资料详细信息

css - 如何覆盖 b-modal 中的 vue-bootstrap 样式

components - 尽管状态更新,为什么 vuex 组件没有更新?

intellij-idea - WebStorm 和 IntelliJ IDEA 在 NPM 运行/调试配置中看不到自定义 NPM 脚本

node.js - 如何将 vcard 写入文件

node.js - LoopBack - 分割 model-config.json

node.js - 在 db.collection.findOne( { parm : value } 中传递变量

javascript - 安装 Node v13 后来自 npm 的警告消息

node.js - 按 ID 查找在 Nodejs MongoDB 中不起作用

javascript - 如何向组件 vue.js 发送两个或多个参数? (vue.js 2)