Angular - ng: command not found

I am trying to learn Angular, and my knowledge is in the newbie terminal. After I installed Angular, then type ng new my-project. I get an answer ng: command not found. I saw other posts that had this problem and I uninstalled and reinstalled npm and ng.

The last step I took was npm install -g @ angular / cli @latest, and then the new my-project.

Then I get ng: command not found.

Thank,

+30
source share
15 answers

I think you are working on Windows to make @jowey answer easier.

  • Install Angular usually from your bash installation. $ npm install -g @angular/cli@latestNext you need to rearrange PATHS to
  • NPM
  • Nodejs
  • Corner CLI

.

enter image description here

+22

, .

, .

npm i -g @angular/cli

, git bash , , . .

+15

, NodeJs . - , , Angular CLI sudo:

sudo npm install -g @angular/cli
+6

* Windows *

, .

NPM wiki :

C:\Program Files (x86)\nodejs C:\Users\\AppData\Roaming\npm PATH, npm, node, npm npm -g install npm @.

, path :

…;C:\<path-to-node-installation>;%appdata%\npm;…

:

  • , …;%appdata%\npm;C:\<path-to-node-installation>;… npm, npm ( node), ​​ Agnular CLI.

  • ( - ) npm node, CLI Angualr. path : …;C:\Users\<username>\AppData\Roaming\npm\node_modules\@angular\cli;C:\<path-to-node-installation>;%appdata%\npm;… …;%appdata%\npm\node_modules\@angular\cli;C:\<path-to-node-installation>;%appdata%\npm;… .

.

+2

mocOS: ng /usr/local/bin. , .

ln -s /usr/local/Cellar/node/10.10.0/lib/node_modules/angular-cli/bin/ng /usr/local/bin/ng
+2

Windows, :

:

C:\Users\[ ]\AppData\Roaming, NPM, Angular npm install -g @angular/cli

+2

NODE NVM .

NODE

NVM https://github.com/creationix/nvm

NODE NVM: nvm install

npm install -g angular -cli

LINK

+1

Mac . , .

sudo npm i -g @angular/cli

+1

, .

Angular , , , Angular . .

, , ng . ,

angular , , ng, .

+1

1: "npm"

C:\Users\YourUserName\AppData\Roaming

2: "npm" Node.Js.

3: Node.JS

4: Angular CLI npm install -g @angular/cli@latest

5: : ng --version ng -v

0

100%

1) rm -rf/usr/local/lib/node_modules

2) brew uninstall node

3) echo prefix=~/.npm-packages >> ~/.npmrc

4) brew install node

5) npm install -g @angular/cli

6) export PATH="$HOME/.npm-packages/bin:$PATH"

, - ,

7) .

100%

0

, , npm.

         mkdir ~/.npm-global
         npm config set prefix '~/.npm-global'
         export PATH=~/.npm-global/bin:$PATH
         source ~/.profile
         npm install -g jshint
         ng --version
0

@angular/cli

npm, npm link @angular/cli

Otherwise, first install angular using npm install @angular/cliand then the npm install @angular/clilink.

0
source

if you have npm install the command

npm install -g @angular/cli

then bind your ng with this:

cd

alias ng=".npm-global/bin/ng"

Stay tuned for more help.

enter image description here enter image description here enter image description here enter image description here

0
source

just install npm install -g @ angular / cli @latest

-4
source

Source: https://habr.com/ru/post/1687083/


All Articles