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 install the Angular using:
npm install -g @angular/cli
Anytime I tried to run ng, I would get:
the term 'ng' is not recognized as the name of a cmdlet
ps1 cannot be loaded because running scripts is disabled on this system vscode. The reason is that, in build command line integrations like visual studio code, you need to set the command line policies by your self. By setting the above configurations, the visual studio code will do that for you.
To solve the error "ng is not recognized as an internal or external command, operable program or batch file", install the angular cli globally by running npm install -g @angular/cli@latest and make sure your PATH environment variable is set up correctly.
Just add: ;C:\Program Files\nodejs\ To the end of your Path variable on the "User variable" section of the Environment Variables on the System Properties. After that, reopen your command prompt and type npm. This should work.
The first path in the path variable needs to be the NPM path. Opening the Node.js command prompt I found that the ng command worked there. I dug into the shortcut and found that it references a command to ensure the first Path variable is NPM. To Fix:
%AppData%\npm
Once I did that I was able to close powershell and reopen and all worked.
First setup Node.js, then run this command to install angular globably:
npm install -g @angular/cli
Now run ng command. This worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With