ng is not recognized as an internal or external command (Windows 10)

Raymond Tang Raymond Tang 0 21569 8.93 index 11/18/2018

Problem

When you follow Angular CLI installation guide in Windows, you may encounter the following error:

ng is not recognized as an internal or external command

The resolutions are available in the following link:

https://stackoverflow.com/questions/37991556/ng-is-not-recognized-as-an-internal-or-external-command

This post adds more details about how to check your npm package location as each individual may have installed it in different places.

Resolution

Open a Command Prompt and type the following command to check your prefix:

npm config get prefix

In my machine, the prefix is ‘D:\Packages\npm’

https://api.kontext.tech/resource/2a7f4d3b-f4e2-507c-9109-9a3f6a3b23a2

Add the prefix location into your PATH environment variable.

*In my environment, I’ve added a configuration file ‘.npmrc’ in my user folder. In the file, it has the following content to configure the prefix location:

prefix = "D:\Packages\npm"

Then the Angular CLI commands should work properly like the following screenshot:

https://api.kontext.tech/resource/4b9ed7a9-452a-5bb7-9d0f-6b9009259026

*Please note your nodejs version needs to be 8.9 or greater to run the CLI otherwise you may encounter an error like below:

You are running version v*.*.* of Node.js, which is not supported by Angular CLI v6. The official Node.js version that is supported is 8.9 and greater.

Please visit https://nodejs.org/en/ to find instructions on how to update Node.js.

angular lite-log

Join the Discussion

View or add your thoughts below

Comments