After removing the previous version of Node.js , now i have installed the latest version of it. I have also installed @angular/cli .
![](https://www.manongdao.com/static/images/pcload.jpg)
But when i am trying to create new Project through CLI , i am getting error
'ng' is not recognized as an internal or external command.
I have uninstalled Node.js several time using command and manually all folder but still it coming after fresh installation.
I have tried to install @angular/cli but getting below error.
![](https://www.manongdao.com/static/images/pcload.jpg)
Any help will be much appreciated.
Thanks in Advance.
There are two reasons.
- It could be you do not have npm folder on your
PATH
after installing Angular (npm install @angular/cli -g
)
Append the below entry in your system or user environment variable:
%USERPROFILE%\AppData\Roaming\npm
Open a new windows shell and ng
command should be available.
ng -v
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 1.7.2 Node: 6.9.2 OS: win32 x64 Angular: ...
- Your Angular version is corrupted. As of Angular 5 you don't need to clean the cache. It self-heals from corruptions.
To check if the cache is corrupted, use
npm cache verify
For older version of Angular, uninstall using:
npm uninstall -g angular-cli
npm uninstall --save-dev angular-cli
To install new version, use:
npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli@latest
Good luck.
Simple way to solve this by using NodeJS
command prompt rather Windows Command, NodeJs
command prompt will recognize ng
.
I did everything above to no avail. Uninstalled VS2017 and NodeJS. After reinstalling NodeJS and angular cli still had same problem. I did a npm get and noticed it was installed in an old folder "c:\programdata\microsoft\visualstudio\mda\taco-toolset.x.x.x.." which made no sense all VS version were completely gone.
It ended up being a file in "c:\users\yourUsername\.npmrc" was the problem as it is not removed after uninstalling NodeJs. Delete that file and reinstall NodeJs , Angular CLI and all was good. This may have been a result of installing VS2017 with NodeJs tools as part of it but am not 100% sure on that.