angular-cli: Error installing angular-cli on Ubuntu

On Ubuntu 14 & 16 Node version: 6.7.0 Npm version: 3.10.3

>$ npm install -g angular-cli@1.0.0-beta.16 
>$ ng -v
>$ The program 'ng' is currently not installed. You can install it by typing:
sudo apt-get install ng-common

The output seems like angular-cli is correctly installed. I’ve fixed the npm sudo permissions.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 24 (2 by maintainers)

Most upvoted comments

i have the same problem . i solve it as follow:

$: echo -e “export PATH=$(npm prefix -g)/bin:$PATH” >> ~/.bashrc && source ~/.bashrc $:ng -v

it works for me !

This might be a general npm problem.

Can you please try the following steps and report the result?

First, run npm bin -g and ensure you have full permissions on the folder that gets printed as a result of this command.

Then run the following series of commands:

sudo npm rm -g angular-cli
npm cache clear
sudo npm install -g angular-cli

Does this solve the problem?

On Ubuntu 16.04 my working solution is sudo npm install --unsafe-perm -g @angular/cli

the solution is here https://github.com/angular/angular-cli/issues/1192

It was a memory issue, my system had only 512mb of ram memory

Try installing it with sudo user

sudo npm install -g angular-cli

Thank you commercialsuicide … you have save my day.

Solved!

I got the same problem because using two versions of node by nvm

Add to your .bachrc file all versions of your nodes!

PATH=…/.nvm/versions/node/v0.12.15/bin:…/.nvm/versions/node/v8.1.3/bin:

cheers!

i have the same problem . i solve it as follow:

$: echo -e “export PATH=$(npm prefix -g)/bin:$PATH” >> ~/.bashrc && source ~/.bashrc $:ng -v

it works for me !

This worked for me!! Thanks!

@commercialsuicide yep your solution worked a treat,

sudo npm install --unsafe-perm -g @angular/cli

seems to do the trick. But could anyone explain why

npm install -g ng

doesn’t work?

and also why the recommended

sudo apt install ng-common

doesn’t work, once installed “ng build” it seems to completely freeze my screen and not allow me to do anything.

This might be a silly question, but are you sure your npm bin path is on the PATH? For instance, can you use other npm packages globally?

npm bin -g
/home/cloud/.npm-global/bin

I’ve the permissions in that folder and the path is included in the PATH env variable.

After running all those commands, nothing changes, ng command does not exist in the /home/cloud/.npm-global/bin folder

ng -v
The program 'ng' is currently not installed. You can install it by typing:
sudo apt-get install ng-common