安装npm install -g @ angular / Cli时出错

时间:2020-08-31 07:46:34

标签: node.js angular-cli node-modules npm-install angular-cli-v6

D:\ CDAC Project \ Nodejs> npm install -g @ angular / cli

npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
C:\Users\Akash Tawade\AppData\Roaming\npm\ng -> C:\Users\Akash Tawade\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng

> @angular/cli@10.0.8 postinstall C:\Users\Akash Tawade\AppData\Roaming\npm\node_modules\@angular\cli
> node ./bin/postinstall/script.js

'node' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @angular/cli@10.0.8 postinstall: `node ./bin/postinstall/script.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @angular/cli@10.0.8 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Akash Tawade\AppData\Roaming\npm-cache\_logs\2020-08-31T07_54_44_998Z-debug.log

我已经看过很多文章来解决此错误,您也可以浏览视频,但这是行不通的。

2 个答案:

答案 0 :(得分:0)

这是我找到的解决方案

解决方案:-

第1步:如果已安装angular / cli,则将其卸载

req.session.stateMap = {
  "12313213dasdasd13123123": "https://module-1.app.com",
  "qweqweqe131313123123123": "https://module-2.app.com"
}

第2步:尝试删除以下文件夹(如果仍然存在)

npm uninstall -g @angular/cli

第3步:尝试删除文件“ ng”和“ ng.cmd”(如果存在)。您会在文件夹下面找到这些文件。

C:\Users\Akash Tawade\AppData\Roaming\npm\node_modules\@angular

第4步:再次全局全局安装angular / cli

C:\Users\Akash Tawade\AppData\Roaming\npm\ng 

C:\Users\Akash Tawade\AppData\Roaming\npm\ng.cmd

答案 1 :(得分:0)

只需在命令中添加以下标记:

npm install -g @angular/cli --unsafe-perm=true --allow-root