Error: ng : The term 'ng' is not recognized as the name of a cmdlet, function, script file, or operable program

Updated on: May 21, 2019

Are you getting following issue, when you are trying to run any ng command from Visual Studio Code or Command prompt window, then you don't need to worry about this error, as there is a quick fix we have found for this issue.

ERROR: "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."

Steps to Fix the issue:

1. Close Visual Studio Code or Command Prompt which you have opened to run "ng" command

2. From Start menu, search for "Environment Variables" as shown below:

3. Click on "Environment Variables" as shown below:

4. Click on "Path" from "User Variables" section and click on "Edit" button as shown below:

5. Click on "New" button in "Edit Environment Variable" popup, and enter the path, where NPM is installed, for us we found NPM at following location:

C:\Users\Logged-In-User-Id\AppData\Roaming\npm

6. Click on "OK" button on "Edit Environment Variable" popup & Click "OK" button on "Environment Variables" popup.

7. Now, you can open the Visual Studio Code or Command Prompt and try to run ng command in the Angular Project Directory, it should work.