34

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:

This editor opens after typing the command and pressing enter

  • 1
    Can you add the output of type ng please? [Edit] your question and add it as plain, code-formatted text, not as screenshot. – Byte Commander Nov 27 '17 at 12:37
  • @ByteCommander i just type ng serve in an angular 5 project. There is not output a blank editor file opens – Abdul Basit Nov 27 '17 at 12:38
  • Please try again in a separate, new terminal window and without navigating to your angular project directory. type should be a shell builtin, if that doesn't work, you did something weird because you're not running a Bash shell then. – Byte Commander Nov 27 '17 at 12:43
  • @ByteCommander its also opening same editor.. What can be the issue? – Abdul Basit Nov 27 '17 at 12:46
  • 1
    @ByteCommander I suspect the OP has misunderstood type ng to be an instruction to "type" the command ng- rather than to "type type ng" – steeldriver Nov 27 '17 at 12:52

3 Answers3

61

This is the terminal editor on the 'ng' alias. Uninstall it with:

sudo apt purge ng-common ng-latin

And then install Angular CLI (assuming you have npm installed) with

sudo npm install -g @angular/cli

If you don't have npm installed have a look here

Fabby
  • 34,259
2

Assuming you installed your node with nvm, then put this in your .bashrc:

alias ang=~/.nvm/versions/node/`nvm current`/bin/ng

Or if your ng command is somewhere else, adjust accordingly. Then use angular with "ang" instead, and use the editor with "ng".

0

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/ng

There are a number of ways to work around the problem. Some are:

PS: To exit the editor the shortcuts Ctrl+x and then Ctrl+c work for me.

upe
  • 103