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

问题描述

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

npm WARN deprecated [email protected]: request has been deprecated,see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: 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/[email protected] 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/[email protected] postinstall: `node ./bin/postinstall/script.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @angular/[email protected] 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

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

解决方法

这是我找到的解决方案

解决方案:-

第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
,

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

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