使用终端安装angular / cli时出错

时间:2017-10-31 06:44:58

标签: angular npm terminal

我正在尝试安装angular / cli,当我在终端中运行npm install -g @ angular / cli时,我想出了这些错误消息

npm ERR! Darwin 16.7.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "@angular/cli"
npm ERR! node v6.11.5
npm ERR! npm  v3.10.10
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/katherine/npm-debug.log

有谁知道如何解决这个问题,问题是什么?

2 个答案:

答案 0 :(得分:1)

您缺少管理员上限。

如果你在linux上运行

sudo npm install -g @angular/cli

如果它在Windows上尝试以管理员

运行命令控制台

答案 1 :(得分:0)

尝试使用sudo

  

sudo npm install -g @ angular / cli