12

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?

Md.Shahjalal
  • 393
  • 1
  • 6
  • 21
  • 3
    check this http://stackoverflow.com/questions/37227794/ng-command-not-found-while-creating-new-project-using-angular-cli – Mithun Sarker Shuvro Nov 29 '16 at 06:33
  • 2
    Possible duplicate of [ng is not recognized as an internal or external command](http://stackoverflow.com/questions/37991556/ng-is-not-recognized-as-an-internal-or-external-command) – xShirase Nov 29 '16 at 06:50
  • i found the solution for that problem https://stackoverflow.com/a/46874999/7968316 – Rixwan Oct 22 '17 at 14:18

7 Answers7

6
  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

manish kumar
  • 4,412
  • 4
  • 34
  • 51
4

You just need to add path in Your Environment Variable. To do this, follow these steps. go to my computer properties >> advanced system settings >> environment variable >> add new variable and assign path to your NPM.

For Example my NPM path:-

path : D:\Users\goldy.b\AppData\Roaming\npm

Goldy
  • 49
  • 3
3

I am using Mac and this worked for me.

alias ng="/Users/Batman/.npm-packages/lib/node_modules/@angular/cli/bin/ng"

user3444999
  • 481
  • 4
  • 10
1

You need to link your angular cli with npm using

npm link @angular/cli

That worked like a charm

Asad Shakeel
  • 1,949
  • 1
  • 23
  • 29
0

I had the same problem. Just change your project name and it will work.

Skyravi
  • 9
  • 1
0

After making an entry to the path variable for C:/Users/{userName}/Appdata/Roaming/npm folder, run the following command npm config get prefix and check whether the output is consistent with the above one i.e. C:/Users/{userName}/Appdata/Roaming/npm.

If the path is not same, make sure that you run the command npm config set prefix "APPDATA\Roaming\npm". Now once you install the angular/cli using -g all corresponding packages will be downloaded in this folder and you will be able to run ng commands from any directory of your machine.

Sen
  • 1,308
  • 12
  • 12
0

If your OS is Windows consider that Power Shell does not support Angular CLI commands... try with command prompt (and remember to open with administrator rights!)

Eros Mazza
  • 304
  • 3
  • 7