Issue
In VS Code when I am running command ng build
, getting error
PS D:\Dashboard\Test1> ng build
ng : The term 'ng' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if
a path was included, verify that the path is correct and try again.
At line:1 char:1
+ ng build
+ ~~
+ CategoryInfo : ObjectNotFound: (ng:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I have added these environment variable in Path
%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;
C:\Users\Avind\AppData\Local\Programs\Microsoft VS Code\bin;
C:\Users\Avind\AppData\Roaming\npm;
How can I get rid of this issue?
Note: I have node.js
at C:\Program Files\nodejs
. From command prompt ng new project
not working but working from node.js
command.
Edit 1: After executing npm install -g @angular/cli@latest
from VS Code terminal getting below msg and ng
cmd not working
PS D:\Path\Test1> npm install -g @angular/cli@latest
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
C:\Users\Avind\AppData\Roaming\npm\ng -> C:\Users\Avind\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
> @angular/cli@9.1.9 postinstall C:\Users\AR20095474\AppData\Roaming\npm\node_modules\@angular\cli
> node ./bin/postinstall/script.js
+ @angular/cli@9.1.9
updated 1 package in 53.477s
Solution
You need to install the latest angular cli to make the ng command work, you can run it from the command termial or visual studio code terminal
npm install -g @angular/cli@latest
if still not working, uninstall and reinstall node.js
from program and feature
.
Answered By – Sajeetharan
Answer Checked By – Gilberto Lyons (AngularFixing Admin)