ng serve opens editor instead of loading local URL
Whenever I type ng serve or ng serve --open, it always opens an editor and doesn't open the project.
You can see this in the images below, this is the first image of command:
This editor opens after typing the command and pressing Enter:
3 Answers
This is the terminal editor on the 'ng' alias. Uninstall it with:
sudo apt purge ng-common ng-latinAnd then install Angular CLI (assuming you have npm installed) with
sudo npm install -g @angular/cliIf you don't have npm installed have a look here
4Assuming you installed your node with nvm, then put this in your .bashrc:
alias ang=~/.nvm/versions/node/`nvm current`/bin/ngOr if your ng command is somewhere else, adjust accordingly. Then use angular with "ang" instead, and use the editor with "ng".
As the other answers suggest, you execute ng (editor) (see man ng) instead of the Angular CLI.
To locate the binary that is actually executed you can use:
$ which ng
/usr/bin/ngThere are a number of ways to work around the problem. Some are:
- Execute
npm startinstead ofng serve - Modify the
PATHenvironment variable (in your.bashrc). E.g.export PATH=~/.npm-global/bin:$PATHif npm's default directory was changed - Use an alias
PS: To exit the editor the shortcuts Ctrl+x and then Ctrl+c work for me.