node.js - 在 mac osx Mojave 上安装 Angular cli 7 时出错

标签 node.js npm node-gyp angular-cli-v7

我在 Node 版本 10.15.3 和 npm 6.9.0 的 Mac Osx Mojave 10.14.5 上安装 angular@cli 时遇到错误

我还尝试删除并重新安装node和npm,并按照这篇文章Error installing angular/cli on macOS mojave - node-pre-gyp进行操作

npm install -g @angular/cli 
sudo npm install -g @angular/cli 

npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/@angular/cli
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/@angular/cli/node_modules
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/@angular
npm ERR! path /usr/local/lib/node_modules/@angular/cli
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/@angular/cli'
npm ERR!  { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules/@angular/cli']
npm ERR!   stack:
npm ERR!    'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules/@angular/cli\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules/@angular/cli' }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/fabiodigiuseppe/.npm/_logs/2019-05-26T15_39_28_869Z-debug.log

最佳答案

对于在安装过程中发现此问题的每个人,我已经通过安装 angular/cli 解决了这个问题:

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

关于node.js - 在 mac osx Mojave 上安装 Angular cli 7 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56315049/

相关文章:

c++ - 从 Web 工作线程调用 C++ v8 函数

javascript - 如何迭代整个数组?然后更新数据库

node.js - 使用 Superagent 服务器端获取连接 ECONNREFUSED 错误

javascript - Express pre remove 触发另一个 pre remove on remove

javascript - npm 多模块和主入口点

node.js - npm install module -g 给出 MaxListenersExceededWarning

node.js - 与 node-gyp 的 python ctypes 等效的 javascript

javascript - 实习生单元测试 : loading modules that need browser context

node.js - 我可以让 nodejs 在未处理的 promise 拒绝时终止吗?

msbuild - 在 Windows 10 上构建 npm bcrypt 包时出错