Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'ng' is not recognized as an internal or external command, [duplicate]

I have just started to work with the CLI and when i tried to install the @angular/cli and run the code ng --help

I am getting the following error

'ng' is not recognized as an internal or external command,

I have gone through all the blogs and didn't find any help after following all the procedures listed in the blogs

  1. I have changed the

user variables path : ;C:\Program Files\nodejs\ and system variable : C:\Program Files\nodejs\ ;%AppData%\npm;;

  1. when i ran the command

    npm install -g @angular/cli

i found the following files under node_modules folder

@angular

-cli

---bin

-----ng

cli

I have tried to clean the cache using

npm cache clean 

and then ran the code

ng --version

but i am getting the error as mentioned in the title

like image 815
Lijin Durairaj Avatar asked Jul 26 '17 14:07

Lijin Durairaj


People also ask

How do I know if NG cli is installed?

To Check Angular CLI version use ng --version or ng v or npm list -global --depth 0 commands. ng --version command returns the details of version of Angular CLI installed and in addition to that version of Angular development packages like @angular-devkit/architect,rxjs etc.. as shown below.

What is not recognized as an internal external command?

The “Python is not recognized as an internal or external command” error is encountered in the command prompt of Windows. The error is caused when Python's executable file is not found in an environment variable as a result of the Python command in the Windows command prompt.

How do I install the latest version of Ng?

Update Angular CLI version Globally First uninstall the existing Angular cli packages. Then run npm cache verify command to clear the node packages cache. Then install latest Angular CLI version using npm install -g @angular/cli@latest command.


1 Answers

I have searched long but didn't found the solution. You have to follow these steps:

  1. Install angular/cli globally
  2. Right after installation complete copy the path showing at the same time in terminal
  3. Paste that path in the PATH environment variable
  4. Restart the terminal this will help

AS after

npm install -g @angular/cli@latest

this path is showing like

C:\Users\rizwan.local\share\npm

enter image description here

copy the path and paste it into Environment variable like

enter image description here

save and run ng -v

Enjoy

like image 105
Rixwan Avatar answered Oct 07 '22 17:10

Rixwan