Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular - ng: command not found

I'm trying to learn Angular and my knowledge in terminal is beginner. After I installed Angular and then type ng new my-project. I get the response ng: command not found. I've seen other posts that had this problem and I've uninstalled and reinstalled npm and ng.

The last step I took was npm install -g @angular/cli@latest then ng new my-project.

Then I get ng: command not found.

like image 309
Frank Avatar asked Oct 07 '17 18:10

Frank


People also ask

How do I fix ng not found?

If they are proper: Find the root global Directory of NPM npm root -g (it will give you root of your global npm store) Uninstall old angular cli with npm uninstall -g angular-cli and npm cache clean. Reinstall new Version of angular npm install -g @angular/cli@latest.

Why is NG not working?

Error 1: 'ng' is not recognized 'ng' is not recognized as an internal or external command. This error is simply telling you that Angular CLI is either not installed or not added to the PATH. To solve this error, first, make sure you're running Node 6.9 or higher.

What is NG command in angular?

The ng new command creates an Angular workspace folder and generates a new application skeleton. A workspace can contain multiple applications and libraries. The initial application created by the ng new command is at the top level of the workspace.


2 Answers

Guess You are running on Windows (To make @jowey's answer more straightforward).

  • Install Angular normally from your bash $ npm install -g @angular/cli@latest Next is to rearrange the PATHS to
  • NPM
  • Nodejs
  • Angular CLI

in System Environment Variables, the picture below shows the arrangement.

enter image description here

like image 141
Adedoyin Akande Avatar answered Sep 17 '22 15:09

Adedoyin Akande


I had that same problem and just solved it.

make sure you have node installed.

after running

npm i -g @angular/cli 

when installation is finished, try re-opening your git bash or whatever you're using or open it in a new folder. boom. it worked for me

like image 27
hajisky Avatar answered Sep 20 '22 15:09

hajisky