-1

I faced a lot of issues since I installed the last version of node.js, so I thought that if I delete every thing and start over I can get every thing to work, so I uninstalled angular/CLI I uninstalled npm npm uninstall -g npm and removed the npm file and uninstalled node.js, and then I reinstalled the node.js and the angular/CLI then I tried to create a new project using ng new my-app suddenly I got

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

I checked if the npm file is created again, and I found it, but it was empty I don't understand what I did wrong

elaaa
  • 19
  • 1
  • 11
  • https://stackoverflow.com/search?q=%27ng%27+is+not+recognized+as+an+internal+or+external+command Always do a search for the error message before posting a new question. Chances are quite good that you're not the first person who has encountered that message. – Ken White May 17 '21 at 01:39
  • None of the solutions in there worked for me the NPM folder is empty no mutter how many times I tried to install angular/CLI – elaaa May 17 '21 at 04:33

1 Answers1

-2

Check node and npm version using following commands.

node -v
npm -v

If both are showing versions then it's okay oterwise you have problem in installing node js. If you'll receive any errors, install nodejs again.

Next staep is to check typescript version using following command.

tsc -v

If it's showing version all okay, otherwise install typescript using this command npm install -g typescript Next step is to check angular version using the following command

ng --version

If it shows you version then good otherwise you have to install angular cli using this command. npm install -g @angular/cli In this way you have to debug the problem. Please try this solution and let me know.

Kartik Dolas
  • 703
  • 1
  • 9
  • 24
  • Thank you , I tried your solution, but it did not work typescript and angular CLI are not recognized even after I used the commands you suggested and for node and npm I got response – elaaa May 17 '21 at 04:31
  • If *'ng' is not recognized'*, how can you possibly run `ng --version`? – Ken White May 17 '21 at 04:47
  • I can't run ng -- version I get 'ng' is not recognized as an internal or external command, operable program or batch file. – elaaa May 17 '21 at 05:00
  • Have you tried installing typescript using this command? what was the errors? and main doubt are you a linux user?? Please don't downvote my answer I am trying my best to help you. Aren't we here to help each other? – Kartik Dolas May 17 '21 at 09:55
  • No I did not downvote your answer it was not me, in fact I really appreciate you helping me. I am a Windows user, I tried all the commands that you suggested and when I run the commands it's like they are installed but when I run `ng --` version I get is `not recognized as an internal or external command, operable program or batch file.` – elaaa May 17 '21 at 14:07
  • Are the commands ```node -v``` and ```npm -v``` giving versions? Let me know till where are you following. – Kartik Dolas May 17 '21 at 15:15
  • yes `node -v` and `npm -v` are giving versions node: v14.17.0 and npm 7.13.0 but the npm folder in C:\Users\\AppData\Roaming is empty – elaaa May 17 '21 at 19:06
  • What is tsc -v showing? – Kartik Dolas May 18 '21 at 03:46
  • Hello, are you done with the issue? – Kartik Dolas May 26 '21 at 18:12