Angular cli 无法在 ubuntu 17.04 上安装

Angular cli 无法在 ubuntu 17.04 上安装

@angular/cli我正在尝试在我的 Linux(Ubuntu 17.04)上安装,我已经更新nodejs到最新版本 8.2.1 和npm5.3.0,但是当我运行命令sudo npm install -g @angular/cli安装时循环出现:

gyp verb command install [ '8.2.1' ]
gyp verb install input version string "8.2.1"
gyp verb install installing version: 8.2.1
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 8.2.1
gyp verb ensuring nodedir is created /usr/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp/8.2.1
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp/8.2.1"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp"
gyp verb tmpdir == cwd automatically will remove dev files after to save disk space

我该如何解决这个问题?我快被这个问题搞疯了

答案1

虽然不太好看,但手动创建丢失的目录似乎有效。

cd /usr/lib/node_modules/@angular/cli/node_modules/node-sass/
mkdir .node-gyp
mkdir .node-gyp/8.2.1
sudo npm install -g @angular/cli

最糟糕的是安装后该目录中甚至什么都没有。

相关内容