Angular 4安装错误

时间:2017-08-27 18:16:08

标签: angular npm

我在安装@ angular / cli包时遇到问题

目前我正在运行node v6.11.2& npm ver 5.3.0

我首先尝试使用sudo npm install -g @angular/cli安装它并得到以下错误,该错误在循环中运行,直到我ctrl + c out:

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
gyp verb command install [ '6.11.2' ]
gyp verb install input version string "6.11.2"
gyp verb install installing version: 6.11.2
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 6.11.2
gyp verb ensuring nodedir is created /usr/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp/6.11.2
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/6.11.2"

在搜索解决方案后,我尝试使用sudo npm install --unsafe-perm -g @angular/cli的工作,而是出现以下错误:

npm ERR! code EAI_AGAIN
npm ERR! errno EAI_AGAIN
npm ERR! request to https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org:443

有人可以提供建议吗?

1 个答案:

答案 0 :(得分:0)

我刚刚找到了解决这个问题的方法!

看起来NPM是否安装了错误的用户权限?我用sudo chown -R $USER /usr/local然后安装了node-gyp-install,然后成功安装了@ angular / cli包!