Angular 9 throw error "ng: command not found" in MacOS
I have a project with Angular 9. After installing angular CLI with command npm install -g angular-cli
.
After that, I tried a ng
command ng --help
what gave me the following message. -bash: ng: command not found.
I check Angular CLI by using the command npm list -g --depth=0
but it shows me that angular-cli is installed.
Riano:~ Riano$ npm list -g --depth=0
/Users/Riano/.npm/lib
├── angular-cli@0.0.33
├── broccoli-plugin@1.2.0
I run in macOS, not in Windows OS.
Thanks for any suggestions.
-
N1
Nam Vo Jun 24 2021
I fixed this issue by adding an alias in my
bash_profile
alias ng="/Users/reinos/.npm/lib/node_modules/angular-cli/bin/ng"
And it worked for me.
-
M0
Minh Vĩnh Jun 24 2021
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
On the window, you should use
npm
and macOS usenvm
-
U0
Ubonwan Raksasat Jun 24 2021
I solved this issue by adding the address of the module installation at ** PATH** computer
in my caseC:\Users\hmuschett\AppData\Roaming\npm
or
C:\Users\local\npm-local\npm-global
Hope it helpful for you!!
* Type maximum 2000 characters.
* All comments have to wait approved before display.
* Please polite comment and respect questions and answers of others.