I was all geared up to explore unit testing in Angular this morning–something I’ve been putting off learning for quite some time–and quickly hit an problem. I started by installing Angular CLI using apt install ng-common
, but trying to use the Angular CLI’s ng
command was launching Emacs!
It took me a minute to figure this out, and here’s what it took. First, I uninstalled:
sudo apt remove ng-common
Next, I installed using npm
:
sudo npm install -g @angular/cli
This was common how-to-fix-it advice, but this didn’t resolve the problem for me. At this point ng
was no longer launching an editor, but instead it was an unrecognized command. Luckily, I found the solution here.
I noticed in the install output that the bin location was listed. I was able to verify where the ng
binary was located and add an alias. After that, ng --version
worked successfully.
Here’s the alias I added to ~/.bashrc
:
alias ng='/usr/local/lib/node_modules/@angular/cli/bin/ng'

One thought on “Installing Angular CLI on Ubuntu 18.04.4 LTS”