Today, while working through some basic AngularJS Intro, I ran into a problem.
I opened PowerShell to get going on the project. NPM worked.
I was able to in
Based on the above answers here is the consolidation.
npm install -g @angular/cli@project_version
Add the below paths to your environment variables -> System Variables -> Path (For which Admin access is required).
C:\Users\YourPcAccountName\AppData\Roaming\npm
C:\Users\YoutPcAccountName\AppData\Roaming\npm\node_modules\angular-cli\bin
Make sure the first value listed as %AppData%\npm
ng serve
.Installing angular cli globally solved my problem.
npm install -g @angular/cli
Also you can run following command to resolve, npm install -g @angular/cli
I was getting this error in Visual Studio Code
while doing ng-build
. Running below command in cmd fixed my issue
npm install -g @angular/cli@latest
You just need to close the visual studio code and restart again. But to get the ng command work in vs code, you need to first compile the project with cmd in administrator mode.
I was also facing the same problem. But this method resolved it.
1)Right Clicked on My Computer (windows) 2)Selected Advanced System Settings 3)Clicked "Environment Variables" 4)Under "Path" variable, made the FIRST value listed %AppData%\npm
Initially: C:\Program Files\Microsoft MPI\Bin\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\TortoiseSVN\bin;
After path adding: C:\Program Files\Microsoft MPI\Bin\;%AppData%\npm;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\TortoiseSVN\bin;
One more thing you can try ,if error still coming, as below 1)go to project location via command prompt:C:\Users\brijeshray\ParentChild> 2)Reinstall or update existing angular as : npm install -g@angular/cli@latest
3)Go to computer or PC-->Properties-->Advanced system setting -->Environment Variable -->add a path below "User variable"(if 'Path' not there) ==>C:\Users\brijeshray\AppData\Roaming\npm -->save it and restart visual code