New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ng: command not found #503

Closed
reinos opened this Issue Apr 22, 2016 · 60 comments

Comments

Projects
None yet
@reinos

reinos commented Apr 22, 2016

After installing angular-cli with the help of this #389 (comment) 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
├── angular-cli@0.0.33
├── broccoli-plugin@1.2.0
└── broccoli-source@1.1.0

Running on a Macos.

Am i missing something?

@reinos

This comment has been minimized.

Show comment
Hide comment
@reinos

reinos Apr 22, 2016

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 commented Apr 22, 2016

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 reinos closed this Apr 22, 2016

@reinos reinos reopened this Apr 22, 2016

@filipesilva

This comment has been minimized.

Show comment
Hide comment
@filipesilva

filipesilva Apr 22, 2016

Member

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.

Member

filipesilva commented Apr 22, 2016

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.

@anode7

This comment has been minimized.

Show comment
Hide comment
@anode7

anode7 Apr 22, 2016

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

anode7 commented Apr 22, 2016

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

@reinos

This comment has been minimized.

Show comment
Hide comment
@reinos

reinos Apr 22, 2016

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

reinos commented Apr 22, 2016

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

@filipesilva

This comment has been minimized.

Show comment
Hide comment
@filipesilva

filipesilva Apr 22, 2016

Member

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

Member

filipesilva commented Apr 22, 2016

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

@anode7

This comment has been minimized.

Show comment
Hide comment
@anode7

anode7 Apr 23, 2016

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

anode7 commented Apr 23, 2016

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

@info007

This comment has been minimized.

Show comment
Hide comment
@info007

info007 May 15, 2016

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 commented May 15, 2016

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"

@aqkhan

This comment has been minimized.

Show comment
Hide comment
@aqkhan

aqkhan Jun 1, 2016

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

aqkhan commented Jun 1, 2016

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

@filipesilva

This comment has been minimized.

Show comment
Hide comment
@filipesilva

filipesilva Jun 2, 2016

Member

@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.

Member

filipesilva commented Jun 2, 2016

@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.

@cdechery

This comment has been minimized.

Show comment
Hide comment
@cdechery

cdechery Jul 12, 2016

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

cdechery commented Jul 12, 2016

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

@pepogreen

This comment has been minimized.

Show comment
Hide comment
@pepogreen

pepogreen Aug 10, 2016

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 commented Aug 10, 2016

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.

@Zaggen

This comment has been minimized.

Show comment
Hide comment
@Zaggen

Zaggen Aug 11, 2016

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 commented Aug 11, 2016

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"

@hmuschett

This comment has been minimized.

Show comment
Hide comment
@hmuschett

hmuschett Aug 29, 2016

hi @Zaggen in windows how to do ? thank u

hmuschett commented Aug 29, 2016

hi @Zaggen in windows how to do ? thank u

@mcferren

This comment has been minimized.

Show comment
Hide comment
@mcferren

mcferren Sep 2, 2016

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 commented Sep 2, 2016

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

@hmuschett

This comment has been minimized.

Show comment
Hide comment
@hmuschett

hmuschett Sep 2, 2016

@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 commented Sep 2, 2016

@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

@mcferren

This comment has been minimized.

Show comment
Hide comment
@mcferren

mcferren Sep 2, 2016

@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 commented Sep 2, 2016

@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

@hmuschett

This comment has been minimized.

Show comment
Hide comment
@hmuschett

hmuschett Sep 2, 2016

@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 commented Sep 2, 2016

@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

@mcferren

This comment has been minimized.

Show comment
Hide comment
@mcferren

mcferren Sep 2, 2016

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

mcferren commented Sep 2, 2016

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

@hmuschett

This comment has been minimized.

Show comment
Hide comment
@hmuschett

hmuschett Sep 2, 2016

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

hmuschett commented Sep 2, 2016

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

@Zaggen

This comment has been minimized.

Show comment
Hide comment
@Zaggen

Zaggen Sep 2, 2016

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 commented Sep 2, 2016

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.

@AlexReff

This comment has been minimized.

Show comment
Hide comment
@AlexReff

AlexReff Sep 22, 2016

Why is this marked as closed? This issue happened for me today on an Ubuntu server using Node (not NVM)

There was no 'lib' folder in /home/[user]/.npm/lib for me to symlink

I ended up removing node and installing nvm, but that can't be an acceptable solution, right?

AlexReff commented Sep 22, 2016

Why is this marked as closed? This issue happened for me today on an Ubuntu server using Node (not NVM)

There was no 'lib' folder in /home/[user]/.npm/lib for me to symlink

I ended up removing node and installing nvm, but that can't be an acceptable solution, right?

@JanStureNielsen

This comment has been minimized.

Show comment
Hide comment
@JanStureNielsen

JanStureNielsen Sep 22, 2016

@AlexReff -- is your PATH as noted in the referenced NPM 13828 issue correct?

JanStureNielsen commented Sep 22, 2016

@AlexReff -- is your PATH as noted in the referenced NPM 13828 issue correct?

@AlexReff

This comment has been minimized.

Show comment
Hide comment
@AlexReff

AlexReff Sep 22, 2016

That topic is specific to Windows. This was not on a Windows platform.

AlexReff commented Sep 22, 2016

That topic is specific to Windows. This was not on a Windows platform.

@m477r33d

This comment has been minimized.

Show comment
Hide comment
@m477r33d

m477r33d Sep 26, 2016

Still occuring with node v5.6.0 npm v3.6.0. Using alias fix.

m477r33d commented Sep 26, 2016

Still occuring with node v5.6.0 npm v3.6.0. Using alias fix.

@maddymaster

This comment has been minimized.

Show comment
Hide comment
@maddymaster

maddymaster Sep 29, 2016

I changed the alias, now I get this error, now how do I undo the alias?

-bash: /root/.nvm/versions/node/v6.3.1/lib/node_modules/angular-cli/bin/ng: No such file or directory

and Mac Users do not try to change the alias, it wont solve the problem

maddymaster commented Sep 29, 2016

I changed the alias, now I get this error, now how do I undo the alias?

-bash: /root/.nvm/versions/node/v6.3.1/lib/node_modules/angular-cli/bin/ng: No such file or directory

and Mac Users do not try to change the alias, it wont solve the problem

@filipesilva

This comment has been minimized.

Show comment
Hide comment
@filipesilva

filipesilva Oct 2, 2016

Member

I know it's frustrating to hear, but there isn't much that we can do here on this repo. If after global install the ng isn't available, it means that either the install failed or that your npm is broken/misconfigured/having problems. Those kind of issues should be filed against https://github.com/npm/npm

Member

filipesilva commented Oct 2, 2016

I know it's frustrating to hear, but there isn't much that we can do here on this repo. If after global install the ng isn't available, it means that either the install failed or that your npm is broken/misconfigured/having problems. Those kind of issues should be filed against https://github.com/npm/npm

@wumpz

This comment has been minimized.

Show comment
Hide comment
@wumpz

wumpz Oct 7, 2016

Same problem here using Windows 10 and actual installer.

wumpz commented Oct 7, 2016

Same problem here using Windows 10 and actual installer.

@fr4ngus

This comment has been minimized.

Show comment
Hide comment
@fr4ngus

fr4ngus Feb 14, 2017

With the latest @angular/cli package (prev called angilar-cli and renamed @angular/cli)

I think nvm is a good workaround, but you just have to add this line to your bash-profile:

open ~/.bash_profile
alias ng="/Users/xxxxx/.npm-packages/lib/node_modules/@angular/cli/bin/ng"

fr4ngus commented Feb 14, 2017

With the latest @angular/cli package (prev called angilar-cli and renamed @angular/cli)

I think nvm is a good workaround, but you just have to add this line to your bash-profile:

open ~/.bash_profile
alias ng="/Users/xxxxx/.npm-packages/lib/node_modules/@angular/cli/bin/ng"
@ipavlyk

This comment has been minimized.

Show comment
Hide comment
@ipavlyk

ipavlyk Feb 16, 2017

open /.zshrc
alias ng="
/lib/node_modules/@angular/cli/bin/ng"

ipavlyk commented Feb 16, 2017

open /.zshrc
alias ng="
/lib/node_modules/@angular/cli/bin/ng"

@bofcarbon1

This comment has been minimized.

Show comment
Hide comment
@bofcarbon1

bofcarbon1 Mar 27, 2017

Update.....

I started a new MEAN stack node.js app on Cloud 9 (Ubuntu) and when using node 6.5.0 got a message that I should convert to 6.10. Used 6.10.1 and that would not recognize 'ng' commands. Changing this 'bash_profile' may or may not be possible developing from an IDE tool where you don't own the file. So I went back to 6.5.0 and it worked fine. I don't understand why the new 6.10.1 version would cause the 'ng' script file to not be found. I'm sticking with 6.5.0 for now warning or not at least it works.

bofcarbon1 commented Mar 27, 2017

Update.....

I started a new MEAN stack node.js app on Cloud 9 (Ubuntu) and when using node 6.5.0 got a message that I should convert to 6.10. Used 6.10.1 and that would not recognize 'ng' commands. Changing this 'bash_profile' may or may not be possible developing from an IDE tool where you don't own the file. So I went back to 6.5.0 and it worked fine. I don't understand why the new 6.10.1 version would cause the 'ng' script file to not be found. I'm sticking with 6.5.0 for now warning or not at least it works.

@ipavlyk

This comment has been minimized.

Show comment
Hide comment
@ipavlyk

ipavlyk Mar 28, 2017

Also posible solution is to reexport (or to verify) path to your .../usr/bin:

export PATH=$HOME/bin:$PATH

ipavlyk commented Mar 28, 2017

Also posible solution is to reexport (or to verify) path to your .../usr/bin:

export PATH=$HOME/bin:$PATH

@bofcarbon1

This comment has been minimized.

Show comment
Hide comment
@bofcarbon1

bofcarbon1 Mar 28, 2017

Are you talking about setting this PATH inside of my application?
Not om my machine?
I use a cloud service to create my code which sits on Ubuntu.
Where would I set the PATH?
In which project file?

B

bofcarbon1 commented Mar 28, 2017

Are you talking about setting this PATH inside of my application?
Not om my machine?
I use a cloud service to create my code which sits on Ubuntu.
Where would I set the PATH?
In which project file?

B

@ipavlyk

This comment has been minimized.

Show comment
Hide comment
@ipavlyk

ipavlyk Mar 28, 2017

I was talking about bin folder which contains refs on cli(s).

ipavlyk commented Mar 28, 2017

I was talking about bin folder which contains refs on cli(s).

@iyunusov

This comment has been minimized.

Show comment
Hide comment
@iyunusov

iyunusov May 2, 2017

Being in the Home directory, simply running:

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

In terminal did fix the issue

iyunusov commented May 2, 2017

Being in the Home directory, simply running:

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

In terminal did fix the issue

@JasonMonroe-EdgeTech

This comment has been minimized.

Show comment
Hide comment
@JasonMonroe-EdgeTech

JasonMonroe-EdgeTech Jun 14, 2017

I was running node v4.5.0. Updating to v8.1.1 fixed the issue for me.

JasonMonroe-EdgeTech commented Jun 14, 2017

I was running node v4.5.0. Updating to v8.1.1 fixed the issue for me.

@leonardopaiva

This comment has been minimized.

Show comment
Hide comment
@leonardopaiva

leonardopaiva Jul 19, 2017

Also posible solution is to reexport (or to verify) path to your .../usr/bin:

export PATH=$HOME/bin:$PATH

for some reason my path was no longer compatible with everything I was exporting in my bash profile,

so type "echo $PATH" and check your path, if npm/bin isnt there add it again through the bash_profile.

  • touch ~/.bash_profile
  • open ~/.bash_profile
  • export PATH="/Users/xxxxxx/npm/bin:$PATH"
  • save and close bash_profile
  • go to terminal and type "source ~/.bash_profile" that will update your PATH
  • "echo $PATH" and check if npm/bin path is there.

leonardopaiva commented Jul 19, 2017

Also posible solution is to reexport (or to verify) path to your .../usr/bin:

export PATH=$HOME/bin:$PATH

for some reason my path was no longer compatible with everything I was exporting in my bash profile,

so type "echo $PATH" and check your path, if npm/bin isnt there add it again through the bash_profile.

  • touch ~/.bash_profile
  • open ~/.bash_profile
  • export PATH="/Users/xxxxxx/npm/bin:$PATH"
  • save and close bash_profile
  • go to terminal and type "source ~/.bash_profile" that will update your PATH
  • "echo $PATH" and check if npm/bin path is there.
@naru6be

This comment has been minimized.

Show comment
Hide comment
@naru6be

naru6be Jul 22, 2017

At last find the solution for ng command is not working issue ,Find the solution below http://itechiesol.blogspot.com/2017/07/angular-cli-ng-command-is-not-working.html

naru6be commented Jul 22, 2017

At last find the solution for ng command is not working issue ,Find the solution below http://itechiesol.blogspot.com/2017/07/angular-cli-ng-command-is-not-working.html

@sayantansinha

This comment has been minimized.

Show comment
Hide comment
@sayantansinha

sayantansinha Aug 12, 2017

@maddymaster alias worked for me in mac, not sure why it did not work for you or if you are still having the issues then you can check if your path is correct.

sayantansinha commented Aug 12, 2017

@maddymaster alias worked for me in mac, not sure why it did not work for you or if you are still having the issues then you can check if your path is correct.

@josephglaspie

This comment has been minimized.

Show comment
Hide comment
@josephglaspie

josephglaspie Aug 29, 2017

I was at the following versions and unable to get it to work:
node --version
v7.9.0
npm --version
4.2.0
After adding the path C:\Users\YourName\AppData\Roaming\npm to my registry I am up and running:

function Set-Path{
<#
.Synopsis
   Add path to $env:Path permanantly
.EXAMPLE
   Set-Path -pathToAdd 'C:\Program Files\Git\usr\bin' -Verbose
#>
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
[string]$pathToAdd,

$envBackup = 'c:\temp\envPathBackup.txt'
)

$oldPath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).path
$oldPath | Out-File $envBackup -Append
$newPath = $oldPath + ';' + $pathToAdd
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $newPath
(Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).path
Write-Host "Old path backed up at" $envBackup -ForegroundColor Green
}
Set-Path -pathToAdd 'C:\Users\YourName\AppData\Roaming\npm'

josephglaspie commented Aug 29, 2017

I was at the following versions and unable to get it to work:
node --version
v7.9.0
npm --version
4.2.0
After adding the path C:\Users\YourName\AppData\Roaming\npm to my registry I am up and running:

function Set-Path{
<#
.Synopsis
   Add path to $env:Path permanantly
.EXAMPLE
   Set-Path -pathToAdd 'C:\Program Files\Git\usr\bin' -Verbose
#>
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
[string]$pathToAdd,

$envBackup = 'c:\temp\envPathBackup.txt'
)

$oldPath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).path
$oldPath | Out-File $envBackup -Append
$newPath = $oldPath + ';' + $pathToAdd
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $newPath
(Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).path
Write-Host "Old path backed up at" $envBackup -ForegroundColor Green
}
Set-Path -pathToAdd 'C:\Users\YourName\AppData\Roaming\npm'
@santiagobernalbetancourt

This comment has been minimized.

Show comment
Hide comment
@santiagobernalbetancourt

santiagobernalbetancourt Sep 1, 2017

-bash: ng: command not found
MacBook-Air-de-xxxxxxxx:~ xxxxxxxx$ npm -v
5.3.0
MacBook-Air-de-xxxxxxxx:~ xxxxxxxx$ ionic -v
3.8.1
MacBook-Air-de-xxxxxxxx:~ xxxxxxxx$ ionic info
[WARN] You are not in an Ionic project directory. Project context may be

   missing.

cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.8.1
ionic (Ionic CLI) : 3.8.1

System:

Node : v6.11.2
npm  : 5.3.0 
OS   : macOS Sierra

MacBook-Air-de-xxxxxxxx:~ xxxxxxxx$ ng -v
-bash: ng: command not found
MacBook-Air-de-xxxxxxxx:~ xxxxxxxx$

" Ayudaaaa"

santiagobernalbetancourt commented Sep 1, 2017

-bash: ng: command not found
MacBook-Air-de-xxxxxxxx:~ xxxxxxxx$ npm -v
5.3.0
MacBook-Air-de-xxxxxxxx:~ xxxxxxxx$ ionic -v
3.8.1
MacBook-Air-de-xxxxxxxx:~ xxxxxxxx$ ionic info
[WARN] You are not in an Ionic project directory. Project context may be

   missing.

cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.8.1
ionic (Ionic CLI) : 3.8.1

System:

Node : v6.11.2
npm  : 5.3.0 
OS   : macOS Sierra

MacBook-Air-de-xxxxxxxx:~ xxxxxxxx$ ng -v
-bash: ng: command not found
MacBook-Air-de-xxxxxxxx:~ xxxxxxxx$

" Ayudaaaa"

@NatasaPeic

This comment has been minimized.

Show comment
Hide comment
@NatasaPeic

NatasaPeic Sep 4, 2017

I have tried all sorts of things, but this did it.

npm uninstall -g angular-cli
npm cache clean
npm install -g angular-cli

Cheers.

NatasaPeic commented Sep 4, 2017

I have tried all sorts of things, but this did it.

npm uninstall -g angular-cli
npm cache clean
npm install -g angular-cli

Cheers.

@nathiyakumar

This comment has been minimized.

Show comment
Hide comment
@nathiyakumar

nathiyakumar Sep 22, 2017

angular cli is not work how to fix the error
Mg++ 1.5beta1 (formerly MicroGnuEmacs Adv.)
this error throw in my terminal

nathiyakumar commented Sep 22, 2017

angular cli is not work how to fix the error
Mg++ 1.5beta1 (formerly MicroGnuEmacs Adv.)
this error throw in my terminal

@davehoo

This comment has been minimized.

Show comment
Hide comment
@davehoo

davehoo Sep 28, 2017

I'm learning Angular on a fresh Windows 7 install and went through the instructions and also got the ng not found error in git bash (mingw32): https://angular.io/guide/quickstart Step 2

SYSTEM@Dave-E6540 MINGW32 ~
$ ng new my-app
bash: ng: command not found

I followed instructions elsewhere to run some commands to determine the path I need to add but it was already added to the Windows Environment Variables for User (since I only installed it for me), and adding it to the System PATH also had no effect (see Start > right-click Computer > Properties > Advanced system settings > Advanced tab > Environment Variables button).

SYSTEM@Dave-E6540 MINGW32 ~
$ npm list -g --depth=0
C:\Users\Dave\AppData\Roaming\npm
`-- @angular/cli@1.4.3

SYSTEM@Dave-E6540 MINGW32 ~
$ npm config get prefix
C:\Users\Dave\AppData\Roaming\npm

The only thing that worked was adding the path in git bash as:
export PATH=$PATH:/c/Users/Dave/AppData/Roaming/npm

Not sure if I'll have to re-add it every session or what the permanent solution is, but the Node install should be able to do this already. Wasn't expecting to hit a roadblock so early, maybe the developer needs to double-check this and reconfigure the install to set the path correctly or if they're not able to do that at least mention the fix for it during the install or documentation.

davehoo commented Sep 28, 2017

I'm learning Angular on a fresh Windows 7 install and went through the instructions and also got the ng not found error in git bash (mingw32): https://angular.io/guide/quickstart Step 2

SYSTEM@Dave-E6540 MINGW32 ~
$ ng new my-app
bash: ng: command not found

I followed instructions elsewhere to run some commands to determine the path I need to add but it was already added to the Windows Environment Variables for User (since I only installed it for me), and adding it to the System PATH also had no effect (see Start > right-click Computer > Properties > Advanced system settings > Advanced tab > Environment Variables button).

SYSTEM@Dave-E6540 MINGW32 ~
$ npm list -g --depth=0
C:\Users\Dave\AppData\Roaming\npm
`-- @angular/cli@1.4.3

SYSTEM@Dave-E6540 MINGW32 ~
$ npm config get prefix
C:\Users\Dave\AppData\Roaming\npm

The only thing that worked was adding the path in git bash as:
export PATH=$PATH:/c/Users/Dave/AppData/Roaming/npm

Not sure if I'll have to re-add it every session or what the permanent solution is, but the Node install should be able to do this already. Wasn't expecting to hit a roadblock so early, maybe the developer needs to double-check this and reconfigure the install to set the path correctly or if they're not able to do that at least mention the fix for it during the install or documentation.

@AlbertWhite

This comment has been minimized.

Show comment
Hide comment
@AlbertWhite

AlbertWhite Oct 12, 2017

For me, it is a problem of adding a Path in to bash_profile for Mac (like global variable in the system):
Step 1: Find where your angular-cli is installed. You can find the path in terminal after you run npm install -g @angular-cli

Step 2:Get the path, for example, "/usr/local/lib/node_modules/lib/node_modules/@angular/cli/bin", I know it is a bit wired..

Step 3: Open your .bash_profile: vi ~/.bash_profile

Step 4: Add the path in step 2 in bash_profile like this: export PATH=/usr/local/lib/node_modules/lib/node_modules/@angular/cli/bin:$PATH

Step 5: Save and quit your vi editor by 'wq'. In the end, you need to source ~/.bash_profile to make your changes work.

After that, you may need to close and reopen your terminal window to let it work. It works for me, hope it also works for you.

AlbertWhite commented Oct 12, 2017

For me, it is a problem of adding a Path in to bash_profile for Mac (like global variable in the system):
Step 1: Find where your angular-cli is installed. You can find the path in terminal after you run npm install -g @angular-cli

Step 2:Get the path, for example, "/usr/local/lib/node_modules/lib/node_modules/@angular/cli/bin", I know it is a bit wired..

Step 3: Open your .bash_profile: vi ~/.bash_profile

Step 4: Add the path in step 2 in bash_profile like this: export PATH=/usr/local/lib/node_modules/lib/node_modules/@angular/cli/bin:$PATH

Step 5: Save and quit your vi editor by 'wq'. In the end, you need to source ~/.bash_profile to make your changes work.

After that, you may need to close and reopen your terminal window to let it work. It works for me, hope it also works for you.

@davehoo

This comment has been minimized.

Show comment
Hide comment
@davehoo

davehoo Oct 20, 2017

I'm guessing the only permanent fix (at least initially) is to install Node for ALL users on Windows (not sure how that's different than System PATH though), but I'd rather not do that. I'll look around for other permanent fixes, maybe there's some special place the Node install sets a path during an ALL users install, but I'll have to dig around for it if nobody knows.

Maybe the issue is just that Angular is checking the wrong PATH place... I don't fully blame the developers for missing something with Windows as it appears overly-complicated to me, but the instructions ultimately should work out of the box.

davehoo commented Oct 20, 2017

I'm guessing the only permanent fix (at least initially) is to install Node for ALL users on Windows (not sure how that's different than System PATH though), but I'd rather not do that. I'll look around for other permanent fixes, maybe there's some special place the Node install sets a path during an ALL users install, but I'll have to dig around for it if nobody knows.

Maybe the issue is just that Angular is checking the wrong PATH place... I don't fully blame the developers for missing something with Windows as it appears overly-complicated to me, but the instructions ultimately should work out of the box.

@ci7i2en4

This comment has been minimized.

Show comment
Hide comment
@ci7i2en4

ci7i2en4 Nov 23, 2017

On macOS 10.13 (High Sierra) the easiest way to get angular-cli is via brew (Homebrew): http://brewformulas.org/AngularCli

Didn't give me any troubles at all.

ci7i2en4 commented Nov 23, 2017

On macOS 10.13 (High Sierra) the easiest way to get angular-cli is via brew (Homebrew): http://brewformulas.org/AngularCli

Didn't give me any troubles at all.

@nathiyakumar

This comment has been minimized.

Show comment
Hide comment
@nathiyakumar

nathiyakumar Nov 24, 2017

Get DISTINCT product name with their respective counts from the below data using array concepts:
{{"id":"7","productdetails":"K26-12|K37-15"},{"id":"27","productdetails":"K26-13"}, {"id":"11","productdetails":"K37-15"},{"id":"17","productdetails":"K25-7|K37-2"}}

OUTPUT:
K25 - 7
K26 - 25
K37 - 32
How to get this output using PHP

nathiyakumar commented Nov 24, 2017

Get DISTINCT product name with their respective counts from the below data using array concepts:
{{"id":"7","productdetails":"K26-12|K37-15"},{"id":"27","productdetails":"K26-13"}, {"id":"11","productdetails":"K37-15"},{"id":"17","productdetails":"K25-7|K37-2"}}

OUTPUT:
K25 - 7
K26 - 25
K37 - 32
How to get this output using PHP

@emran-shaikh

This comment has been minimized.

Show comment
Hide comment
@emran-shaikh

emran-shaikh Jan 24, 2018

Have the same problem but when set the system PATH it resolved my issue.

emran-shaikh commented Jan 24, 2018

Have the same problem but when set the system PATH it resolved my issue.

@lifenstein

This comment has been minimized.

Show comment
Hide comment
@lifenstein

lifenstein Feb 1, 2018

npm link @angular/cli fixed this for me.

lifenstein commented Feb 1, 2018

npm link @angular/cli fixed this for me.

@krgauravlpu

This comment has been minimized.

Show comment
Hide comment
@krgauravlpu

krgauravlpu Feb 5, 2018

IT WORKED AFTER DOING THIS : npm install npm@latest -g. TRY THIS

krgauravlpu commented Feb 5, 2018

IT WORKED AFTER DOING THIS : npm install npm@latest -g. TRY THIS

@raky35

This comment has been minimized.

Show comment
Hide comment
@raky35

raky35 Feb 22, 2018

Ng not found issue
Finally what a big relief ... different approach helped me to sort out ng issue in my Mac Pro.
i searched for ng in mac and found that it is available under /node_modules/.bin so i have set the path and created Alias in my .bash_profile. and ng started throwing some permission error when i ran
ng new MyDummyproject and warning as well..

node -v
v8.9.4
npm -v
5.6.0

sh-3.2# open -t .bash_profile

export PATH=/node_modules/.bin:$PATH
alias ng="/node_modules/.bin/ng"

Warning : As a forewarning, we are moving the CLI npm package to "@angular/cli" with the next release,
which will only support Node 6.9 and greater. This package will be officially deprecated
shortly after.

To disable this warning use "ng set --global warnings.packageDeprecation=false".

Permission error : Look like i need create a full permission for teh folder where i want to i run and create a new project "ng new MYprojects"
Cheers,

raky35 commented Feb 22, 2018

Ng not found issue
Finally what a big relief ... different approach helped me to sort out ng issue in my Mac Pro.
i searched for ng in mac and found that it is available under /node_modules/.bin so i have set the path and created Alias in my .bash_profile. and ng started throwing some permission error when i ran
ng new MyDummyproject and warning as well..

node -v
v8.9.4
npm -v
5.6.0

sh-3.2# open -t .bash_profile

export PATH=/node_modules/.bin:$PATH
alias ng="/node_modules/.bin/ng"

Warning : As a forewarning, we are moving the CLI npm package to "@angular/cli" with the next release,
which will only support Node 6.9 and greater. This package will be officially deprecated
shortly after.

To disable this warning use "ng set --global warnings.packageDeprecation=false".

Permission error : Look like i need create a full permission for teh folder where i want to i run and create a new project "ng new MYprojects"
Cheers,

@aweigl

This comment has been minimized.

Show comment
Hide comment
@aweigl

aweigl Jun 22, 2018

using npm start instead of ng serve works. It intitates ng serve.

aweigl commented Jun 22, 2018

using npm start instead of ng serve works. It intitates ng serve.

@ab-iman

This comment has been minimized.

Show comment
Hide comment
@ab-iman

ab-iman Jul 1, 2018

Windows users, add %APPDATA%/npm to the Path variable and relaunch your terminal.

ab-iman commented Jul 1, 2018

Windows users, add %APPDATA%/npm to the Path variable and relaunch your terminal.

@JosephDunivan

This comment has been minimized.

Show comment
Hide comment
@JosephDunivan

JosephDunivan Aug 3, 2018

If anyone is on a mac simply type this in terminal and hit enter.
export PATH="$HOME/.npm-packages/bin:$PATH"

JosephDunivan commented Aug 3, 2018

If anyone is on a mac simply type this in terminal and hit enter.
export PATH="$HOME/.npm-packages/bin:$PATH"

@trevorlitsey

This comment has been minimized.

Show comment
Hide comment
@trevorlitsey

trevorlitsey Sep 3, 2018

This finally worked for me:

alias ng="/Users/MY_USER_NAME/.npm-global/lib/node_modules/@angular/cli/bin/ng"

trevorlitsey commented Sep 3, 2018

This finally worked for me:

alias ng="/Users/MY_USER_NAME/.npm-global/lib/node_modules/@angular/cli/bin/ng"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment