angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

ng: command not found

Open reinos opened this issue 10 years ago • 73 comments

After installing angular-cli with the help of this https://github.com/angular/angular-cli/issues/389#issuecomment-213420501 i installed Angular-cli successfully.

After that i tried a ng command ng --help what gave me the following message. -bash: ng: command not found

Running npm list -g --depth=0 shows me that angular-cli is installed.

ReinosMac:~ reinos$ npm list -g --depth=0
/Users/reinos/.npm/lib
├── [email protected]
├── [email protected]
└── [email protected]

Running on a Macos.

Am i missing something?

reinos avatar Apr 22 '16 14:04 reinos

seems to fixed when i add a alias in my bash_profile

alias ng="/Users/reinos/.npm/lib/node_modules/angular-cli/bin/ng"

but that should not be the way to do, right...?

reinos avatar Apr 22 '16 14:04 reinos

Yeah, you shouldn't need to do that really... how odd. That seems like an npm issue though, where npm isn't setting the path correctly or something.

filipesilva avatar Apr 22 '16 14:04 filipesilva

npm install npm@latest -g should solve the npm-cli problem "NO SUDO"

anode7 avatar Apr 22 '16 14:04 anode7

Removing NODE and using NVM instead fixed a lot of issues.

  • removing Node from your system
  • install NVM from here https://github.com/creationix/nvm
  • Install Node via NVM: nvm install stable
  • run npm install -g angular-cli

reinos avatar Apr 22 '16 15:04 reinos

Come to think of it, I'm using NVM myself. Good advice @reinos.

filipesilva avatar Apr 22 '16 15:04 filipesilva

just missing npm-cli ├── npm@*** in your prefix .npm/lib list

anode7 avatar Apr 23 '16 13:04 anode7

Even when I type ng --help same issue ng: command not found, is there any other alternate rather using nvm because I would like to use npm. I tried to correct the path by adding alias in my .profile but already proxy settings are there, so how can I add new path using alias ng="Users/xxxx/npm/lib/node_modules/angular-cli/bin/ng"

info007 avatar May 15 '16 07:05 info007

Adding alias worked for me but it's weird, this issue.

aqkhan avatar Jun 01 '16 00:06 aqkhan

@info007 you shouldn't have to use nvm, no. Don't quite get why the ng command isn't being copied over to the global npm commands overall, it's not special or different from other global npm commands in any way.

filipesilva avatar Jun 02 '16 02:06 filipesilva

Apparently this is still an issue. Installed angular-cli today, read all the suggestions here. Nothing works. Had to manually add a symlink.

cdechery avatar Jul 12 '16 19:07 cdechery

I got this error after I change my node from my initial install. I reinstalled using -g works well for me. $npm install -g angular-cli I am using nvm for handling node versions.

pepogreen avatar Aug 10 '16 15:08 pepogreen

I'm using nvm on an ubuntu machine, i solved by using alias too, like this alias ng="/root/.nvm/versions/node/v6.3.1/lib/node_modules/angular-cli/bin/ng"

Zaggen avatar Aug 11 '16 20:08 Zaggen

hi @Zaggen in windows how to do ? thank u

hmuschett avatar Aug 29 '16 20:08 hmuschett

same problem for me: ng: command not found

I am on apple osX 10.9.5

$ node --version v6.5.0 $ npm --version 3.10.3

mcferren avatar Sep 02 '16 05:09 mcferren

@mcferren It is solved by adding the address of the module installation at ** PATH** computer in my case

C:\Users\hmuschett\AppData\Roaming\npm

or

C:\Users\local\npm-local\npm-global

hmuschett avatar Sep 02 '16 12:09 hmuschett

@hmuschett can you please expand on your suggestion? I am unclear when/where I should add the address (during installation? before ng terminal command? ). Could you please provide me the steps from scratch in order to install angular cli and then use all of its ng terminal commands? Many thanks in advance

mcferren avatar Sep 02 '16 17:09 mcferren

@mcferren see https://github.com/npm/npm/issues/13828 tienes buscar en tu ordenador la ruta en donde npm instala los paquetes globales y esa ruta añadirla a la variable "PATH" de tu sistema operativo para que este recocnosca los comandos instalados

hmuschett avatar Sep 02 '16 18:09 hmuschett

se puede compartir el command teminal para hacer eso? muchas gracias para la ayuda

mcferren avatar Sep 02 '16 19:09 mcferren

@mcferren i do not understand you, you have to restart the pc to see the changes

hmuschett avatar Sep 02 '16 20:09 hmuschett

Hi @hmuschett, on windows 10 it worked right out of the box, so i can't help with that, i only had issues with ubuntu. Btw, what you suggested to @mcferren is regarding windows installation, but he stated that he is using mac. @mcferren OsX is pretty much a flavor of linux, so i have no idea if it'll work but you could try and copy+paste and run the command i placed for ubuntu on my last comment and check if it works, if not then i have no idea how to help.

Zaggen avatar Sep 02 '16 21:09 Zaggen