当我尝试使用terminal命令安装angular / cli时。 " [sudo] nam install -g @ angular / cli"之后
gyp verb tmpdir == cwd automatically will remove dev files after to save disk space
gyp verb command install [ '8.9.4' ]
gyp verb install input version string "8.9.4"
gyp verb install installing version: 8.9.4
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 8.9.4
gyp verb ensuring nodedir is created /usr/local/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp/8.9.4
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/local/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp/8.9.4"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp"

你可以看到最后一行警告EACCES用户" root"没有权限访问开发目录" /usr/local/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp/8.9.4"
之后我使用" ls -la / usr / local / bin"检查了dir。
Niteshs-Air:~ niteshwaghmare$ ls -la /usr/local
total 0
drwxr-xr-x 8 root wheel 256 Mar 2 22:01 .
drwxr-xr-x@ 9 root wheel 288 Dec 2 01:02 ..
-rw-r--r-- 1 root wheel 0 Mar 1 21:32 .com.apple.installer.keep
drwxr-xr-x 8 root wheel 256 Mar 3 20:38 bin
drwxr-xr-x 2 root wheel 64 Mar 2 22:01 etc
drwxr-xr-x 3 root wheel 96 Jan 3 08:23 include
drwxr-xr-x 4 root wheel 128 Jan 3 08:23 lib
drwxr-xr-x 5 root wheel 160 Jan 3 08:23 share

答案 0 :(得分:0)
我遇到了同样的问题。导致这个问题的原因我不知道。由于它似乎是一个权限问题,我暂时更改了/ usr / local / lib / node_modules中@angular文件夹的权限:
这对我有用