Javascript ubunu中的Angular CLI安装错误-我尝试在我的ubuntu计算机中运行Angular CLI命令时出错

Javascript ubunu中的Angular CLI安装错误-我尝试在我的ubuntu计算机中运行Angular CLI命令时出错,javascript,angular,ubuntu,npm-install,ubuntu-18.04,Javascript,Angular,Ubuntu,Npm Install,Ubuntu 18.04,我犯了这个错误。 我已经在我的系统中安装了NodeJS和npm。 我还删除了npm缓存 npm ERR! code EACCES npm ERR! syscall access npm ERR! path /usr/local/lib/node_modules npm ERR! errno -13 npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules' npm ERR! { Error: E

我犯了这个错误。 我已经在我的系统中安装了NodeJS和npm。 我还删除了npm缓存

npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
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! 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.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/user/.npm/_logs/2020-11-03T18_21_04_293Z-debug.log
~~~

不要使用
sudo
解决此问题。使用
sudo
它在Ubuntu中的使用方式:对于每个需要它的命令,不再使用。不要使用
sudo
运行命令,除非它需要是root。例如,大多数用户只需要
sudo
来安装东西

你试过吗

要测试新配置,请在不使用
sudo
的情况下全局安装软件包:

npm install -g @angular/cli

问题很明显:
EACCES:permission denied,access'/usr/local/lib/node\u modules'
。如果可能的话,我建议使用重复命令。否则,如果无法获得“root”权限,则始终可以在本地安装npm软件包:您可能应该在本地安装npm软件包,而不是以root身份运行。
npm install -g @angular/cli