angular-cli – Angular CLI安装错误

前端之家收集整理的这篇文章主要介绍了angular-cli – Angular CLI安装错误前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
当我在MacOS上运行npm install -g angular-cli时,我不断收到此错误

npm ERR! node v6.9.2
npm ERR! npm  v3.10.9
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access

npm ERR! Error: EACCES: permission denied,access '/usr/local/lib/node_modules'
npm ERR!     at Error (native)
npm ERR!  { Error: EACCES: permission denied,access '/usr/local/lib/node_modules'
npm ERR!     at Error (native)
npm ERR!   errno: -13,npm ERR!   code: 'EACCES',npm ERR!   syscall: 'access',npm ERR!   path: '/usr/local/lib/node_modules' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/apple/npm-debug.log

解决方法

当您在任何平台上使用npm install -g并获得EACCES时,您将写入您没有写入权限的目录.

有些人可能会建议使用sudo,但这会在将来导致更多问题. npm documentation提供了解决此问题的步骤.

我强烈推荐选项3,使用Homebrew安装Node.

猜你在找的Angularjs相关文章