简体   繁体   English

无法安装Angular CLI

[英]Trouble installing Angular cli

Im trying to install the angular cli using terminal but i keep getting this error 我正在尝试使用终端安装角度cli,但我一直收到此错误

- 
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
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!  { Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR!   stack: 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'',
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.
➜  ~** 

I am using my admin account so i am not sure why it is not working, also i have installed node.js just fine without any issues. 我正在使用我的管理员帐户,所以我不确定为什么它不起作用,而且我已经安装好node.js且没有任何问题。

Check if your application has package.json. 检查您的应用程序是否具有package.json。 If not then run 如果没有,则运行

npm init 

If package.json exists try running 如果package.json存在,请尝试运行

npm i

and then run 然后运行

npm i -g @angular/cli

尝试使用--allow-root标志

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM