Command not found: ng

Uncategorized

After I ran npm install @angular/cli, I could still not run the ng command.  My terminal said that the command was not found.  Btw, I use fish.  Here’s what I had to do to solve the problem.

Run:

npm list -g

The very first line will show you where your global node modules are stored.  Which in my case was /Users/user_name/.npm-packages/lib

Navigate to that folder, in my case:

cd /Users/user_name/.npm-packages/lib

Now cd into each folder and ls until you see the folder @angular.

cd @angular/cli/bin

Type ls and you should see the file ng.

Type pwd and copy the path to the current folder.

Now add ng as alias.

In fish: vi ~/.config/fish/config.fish

In bash: vi ~/.bashrc

Add the line: alias ng=”url_that_you_copied_before/ng”

Exit vim

Restart your terminal.  And you should be good to go!

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s