2

I am unable to run ng serve command on Windows 10

I have successfully installed npm and node

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 command. Please help me to solve this issue.

Karan
  • 359
  • 4
  • 18
  • did you create a project using `ng new appName` – Denuka May 29 '19 at 05:42
  • please check this url and this may be the possible solution https://stackoverflow.com/questions/37991556/ng-is-not-recognized-as-an-internal-or-external-command – Phani May 29 '19 at 05:42
  • Yes @DenukaNirmalee but it gives me error ng is not recognized – Karan May 29 '19 at 05:46
  • @Techiepop I tried that link, but it is not working. C:\Users\shaha\AppData\Roaming\npm in this path npm folder is empty – Karan May 29 '19 at 05:47
  • @Karan can u check these https://programmingwithmosh.com/angular/common-angular-errors/ – Phani May 29 '19 at 05:49
  • Possible duplicate of [ng is not recognized as an internal or external command](https://stackoverflow.com/questions/37991556/ng-is-not-recognized-as-an-internal-or-external-command) – Thamaraiselvam May 29 '19 at 06:18

3 Answers3

1

Its because of environment path setup

For now you can use npm run ng serve command

Community
  • 1
  • 1
Shubham Ghormade
  • 215
  • 4
  • 16
0

Run the following the command to know npm default path

npm config get prefix

If the path is different than AppData/npm then change it

npm config set prefix "$APPDATA\npm"

And again run npm config get prefix to get current path then set it to Environment Variables and restart the system

You will need to log out then log back in for the change to your PATH variable to take effect.

Community
  • 1
  • 1
Thamaraiselvam
  • 6,961
  • 8
  • 45
  • 71
0

for run ng serve you can use npm start

Son Andreas
  • 66
  • 1
  • 3