windows 10 - _Git Bash_
Hello,
I tried a lot of solutions on the net but nothing works: /
I still have: ng: command not found
it should be noted that the command was working a few days ago ..
otherwise, I notice that I miss the executable ng, someone would have a solution?
I'm stuck since a week on my project: /

Did you try uninstalling and installing the angular cli?
I.e.
npm uninstall -g @angular/cli
npm install -g @angular/cli
@AhsanAyaz, yes I did it, and much more .. but nothing works, is there on Windows a solution other than this basic solution?
By the way I uninstalled today Node (already done before but to try again), but by going on the site to reinstall Node, I discover this:

do you advise me to wait for the update or not? if not, is there an equivalent to Node?
Thank you :)
I know there have been reports of users that ended up having two npm/node installs. You should try to look for a second global node/npm folder and delete it.
It's hard to know myself since I don't suffer from that problem.... but since you are using git bash perhaps you can do which node or which npm, uninstall node and npm, then try doing which again. Maybe that will tell you where the second folder is.
Sorry I can't be of more help, but this really is a problem with your system and not Angular CLI. Your system isn't installing packages in a place where it recognizes them.
I had the same problem and tried every possible way including uninstall & reinstall to make it works. Also, I have double checked my PATH and everything is ok with the PATH. But no was successful.
I just tried with Command Prompt and ng command works. You can try it instead of Bash.
But it is showing the following issue when I run ng command:
As a forewarning, we are moving the CLI npm package to "@angular/cli" with the n
ext release,
which will only support Node 6.9 and greater. This package will be officially de
precated
shortly after.
To disable this warning use "ng set --global warnings.packageDeprecation=false".
I actually don't get why this is not working in Bash. Anyway, I run the suggested command to hide warning.
For anyone who is new to angular and having issues with ng,
On windows 10, nodejs (and hence NPM) installed under C:\ProgramFiles\nodejs, which was on my system path. However, when installing @angular/cli globally (npm install -g @angular/cli), by default this installed to C:\users\<me>\AppData\Roaming, which I had to manually add to the system path. Once added to the path, it was picked up by git-bash, cmd etc...
@Mohamed-Ikbel - did you find a solution? I'm facing same issue , nothing helps
I was facing the same issue, tried with root/administrator user it worked for me.
So use sudo npm install -g @angular/cli
@anupama-netke took your advice and did this:
sudo npm uninstall -g @angular/cli
sudo npm install -g @angular/cli
sudo ng generate component Home
You are a boss!
hi team , Afraid to share there is serious issue installing node in mac - installation is a success but ng command is not recognised ..
sh-3.2# npm list -global --depth 0
/var/root/.npm-global/lib
├── @angular/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]
npm ERR! peer dep missing: node-sass@^4.0.0, required by [email protected]
sh-3.2# ng
sh: ng: command not found
sh-3.2# npm uninstall -g @angular/cli
npm ERR! path /var/root/.npm-global/bin/ng
npm ERR! code EEXIST
npm ERR! Refusing to delete /var/root/.npm-global/bin/ng: ../lib/node_modules/angular-cli/bin/ng symlink target is not controlled by npm /var/root/.npm-global/lib/node_modules/@angular/cli
npm ERR! File exists: /var/root/.npm-global/bin/ng
npm ERR! Move it away, and try again.
npm ERR! A complete log of this run can be found in:
npm ERR! /var/root/.npm/_logs/2018-02-21T23_21_23_089Z-debug.log
sh-3.2# sudo npm install -g @angular/cli
npm WARN [email protected] requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm ERR! path /var/root/.npm-global/bin/ng
npm ERR! code EEXIST
npm ERR! Refusing to delete /var/root/.npm-global/bin/ng: ../lib/node_modules/angular-cli/bin/ng symlink target is not controlled by npm /var/root/.npm-global/lib/node_modules/@angular/cli
npm ERR! File exists: /var/root/.npm-global/bin/ng
npm ERR! Move it away, and try again.
npm ERR! A complete log of this run can be found in:
npm ERR! /var/root/.npm/_logs/2018-02-21T23_24_24_195Z-debug.log
sh-3.2# npm install npm -global
/var/root/.npm-global/bin/npm -> /var/root/.npm-global/lib/node_modules/npm/bin/npm-cli.js
/var/root/.npm-global/bin/npx -> /var/root/.npm-global/lib/node_modules/npm/bin/npx-cli.js
sh-3.2# ng
sh: ng: command not found
sh-3#sh-3.2# npm list -g --depth=0
/var/root/.npm-global/lib
├── @angular/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]
npm ERR! peer dep missing: node-sass@^4.0.0, required by [email protected]
sh-3.2#
im also facing this issue, can anyone help me
use nodejs command instead
Run following command when you open command line:-
alias ng="<path-to-this-place>/AppData/Roaming/npm/node_modules/@angular/cli/bin/ng"
It just needs to executed every time you open command line but it will work.
For anyone who is new to angular and having issues with ng,
On windows 10, nodejs (and hence NPM) installed under C:\ProgramFiles\nodejs, which was on my system path. However, when installing
@angular/cliglobally (npm install -g @angular/cli), by default this installed toC:\users\<me>\AppData\Roaming, which I had to manually add to the system path. Once added to the path, it was picked up by git-bash, cmd etc...
in my case (windows10), the issue is just the same, but the path to be added is C:\users\<me>\AppData\Roaming\npm
hope i would help someone
Run following command when you open command line:-
alias ng="<path-to-this-place>/AppData/Roaming/npm/node_modules/@angular/cli/bin/ng"It just needs to executed every time you open command line but it will work.
It works ! If you don't want to write it every single time make a Doskey alias which is permanent.
Follow this for the doskey alias : Doskey Tutorial
Same problem here:
I created an emty folder:
i run npm uninstall -g @angular/cli
then npm install -g @angular/cli
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
For anyone who is new to angular and having issues with ng,
On windows 10, nodejs (and hence NPM) installed under C:\ProgramFiles\nodejs, which was on my system path. However, when installing
@angular/cliglobally (npm install -g @angular/cli), by default this installed toC:\users\<me>\AppData\Roaming, which I had to manually add to the system path. Once added to the path, it was picked up by git-bash, cmd etc...