Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ng command not found angular-cli when create new project in windows

Tags:

node.js

i am successfully install node.js and angularjs2 using this command. node version is

node version v6.9.1

npm install -g angular-cli

and the installation path is that

C:\Users\Arobil\AppData\Roaming\npm\node_modules\angular-cli\bin

which are include

system->advanced system setting->Environment variable->path

but the problem is that when i create new project using angular its

D:>ng new app 'ng' is not recognized as an internal or external command, operable program or batch file.

Am i missing anything?

like image 765
Md.Shahjalal Avatar asked Nov 29 '16 05:11

Md.Shahjalal


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.

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.

How do you fix Ng is not recognized as an internal or external command?

To solve the error "ng is not recognized as an internal or external command, operable program or batch file", install the angular cli globally by running npm install -g @angular/cli@latest and make sure your PATH environment variable is set up correctly.

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.


2 Answers

You need to link your angular cli with npm using

npm link @angular/cli

That worked like a charm

like image 184
Asad Shakeel Avatar answered Sep 22 '22 09:09

Asad Shakeel


  1. Uninstall Everything npm uninstall -g angular-cli
 npm uninstall -g @angular/cli

 npm cache clean
  1. Re-install
npm install -g @angular/cli

Now have a look in your global NPM folder, it should be something like "/Users//.npm-global/bin/". In here you should see your angular CLI files. To test if everything works, try typing:

 ng -v

If this does not work, then try manually adding an alias that mappings ng to your ng folder, like so:

 alias ng="/Users/<username>/.npm-global/bin/ng"

I've also had issues where I have not had 'sudo' permissions. To get around this you can change your global path. To do this you can do something like this within your ~/.bash_profile :

export PATH="$HOME/.npm-packages/bin:$PATH"

Taken from here

like image 20
manish kumar Avatar answered Sep 18 '22 09:09

manish kumar