Angular - ng: command not found

2020-05-30 07:35发布

I am 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.

标签: angular
20条回答
Ridiculous、
2楼-- · 2020-05-30 08:08

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

查看更多
三岁会撩人
3楼-- · 2020-05-30 08:11

Step 1 : Delete "npm" folder from the following path

C:\Users\YourUserName\AppData\Roaming

Step 2 : Once you have the "npm" folder deleted, uninstall Node.Js.

Step 3 : Reinstall Node.JS

Step 4 : Install Angular CLI Using this command npm install -g @angular/cli@latest

Step 5: Now try : ng --version or ng -v

查看更多
登录 后发表回答