I am trying to install angular on Windows 10.

1- My node version is

node -v v10.16.0 

and npm version is

npm -v 6.9.0 

After running command of angular cli which is

npm install -g @angular/cli 

I am not able to run ng serve command. It show this error

'ng' is not recognized as an internal or external command, operable program or batch file. 

I have looked some online solutions which says to set 'PATH` but my path npm folder is empty

C:\Users\shaha\AppData\Roaming\npm 

I have tried many times uninstallation and installation of nodejs but I am unable to run ng serve commmand. Please help me to solve this issue.

2 Answers

Introduction

When you type a command in command prompt, if it's a program, the reason it's available for use is because it's accessible from the PATH.

PATH is an environment variable. There is a PATH variable in your user variables, and a second one in your system variables.

PATH denotes a set of locations on your computer with programs and components that should be available globally.

Solution 1 - Edit your PATH

Firstly locate ng.exe on your computer. You may find it in your program files. If you don't know where to look for it, simply open 'Computer' and do full system search for it.

Once you've located ng.exe you will have to add the location to your user or system PATH variable. Environment variables can be edited in the advanced tab of 'System Properties' after clicking the 'Environment Variables' button.

Add a semicolon and the location of ng.exe to the end of the PATH variable.

You may use a tutorial for editing the PATH found on the internet. Here is an example of a tutorial.

Disclaimer: Editing your PATH incorrectly can cause system issues. A better solution would be to contact the maintainer of the program you're trying to install and have them fix the installer.

Solution 2 - Explicitly Run ng.exe

Firstly locate ng.exe on your computer. You may find it in your program files. If you don't know where to look for it, simply open 'Computer' and do full system search for it.

Once you've located it, instead of using ng serve in your command prompt, copy the file location and use the full file location in replacement of "ng".

Example:

ng serve

becomes

C:\path\to\installation\folder\ng.exe serve

I think this is a linking problem, you may not have installed it globally by including this -g after in the command during installing it Anyways Try this to link it:

npm link @angular/cli 

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy