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
.
if you have npm, install run the command
npm install -g @angular/cli
then bind your ng using this:
cd
Follow the Pictures for more help.
In my case
OS Version:
Ubuntu 18.04.4 LTS
Node version
v12.16.0
Remove ng from
/usr/local/bin
by using below command.sudo rm -r ng
After that, installed ng by using command mentioned below.
sudo npm install -g @angular/cli
I tried this and everything worked by changing the npm directory.
Restart you machine
then
>> npm install -g @angular/cli@latest
set Path : C:\Users\admin\AppData\Roaming\npm\node_modules@angular\cli
Hope you never get 'ng' not found
The error may occur if the
NodeJs
is installed incorrectly. The proper way to fix that is to reinstall it properly, but if you're searching for a quick solution, you can try to install Angular CLI globally withsudo
:I had a lot of issues installing it on a mac with all the permission errors Finally the following line solve the issue.