Installation Ubuntu 16.04(Xenial Xerus)中的角度安装失败

Installation Ubuntu 16.04(Xenial Xerus)中的角度安装失败,installation,angular-cli,ubuntu-16.04,Installation,Angular Cli,Ubuntu 16.04,Angular CLI在运行安装命令时始终显示错误,ng显示未找到此类命令。我如何解决这个问题 我又跑了一次,现在我明白了: shivashish-Inspiron-3521% npm install -g @angular/cli npm WARN checkPermissions Missing write access to /usr/lib/node_modules npm ERR! path /usr/lib/node_modules npm ERR! code EACCES npm

Angular CLI在运行安装命令时始终显示错误,
ng
显示未找到此类命令。我如何解决这个问题

我又跑了一次,现在我明白了:

shivashish-Inspiron-3521% npm install -g @angular/cli
npm WARN checkPermissions Missing write access to /usr/lib/node_modules
npm ERR! path /usr/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules'
npm ERR!  { Error: EACCES: permission denied, access '/usr/lib/node_modules'
npm ERR!   stack: 'Error: EACCES: permission denied, access \'/usr/lib/node_modules\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/lib/node_modules' }
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!     /home/shivashish/.npm/_logs/2018-11-25T13_53_57_814Z-debug.log

这是因为它应该是
@angular/cli
而不是
angular/cli
。正确的命令是:

sudo npm install -g @angular/cli


PS:在linux上全局安装(
-g
参数)时,请不要忘记使用
sudo

我更改了它,但同样的问题再次出现。嗯,谢谢;请为您的帖子创建更新部分,以便打印新日志。我当前的回答确实符合您当前的情况,因此我建议您单独更新一节,谢谢。我注意到更新的错误日志显示您不再在命令前面使用
sudo
;这就是权限问题。我把它改为@angular,但仍然是同一个问题。嗨,请仔细阅读我的答案;您还需要使用
sudo
,否则会出现权限问题
sudo npm install -g @angular/cli