Skip to content

Error installing angular-cli on Ubuntu #2536

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ghost opened this issue Oct 5, 2016 · 24 comments
Closed

Error installing angular-cli on Ubuntu #2536

ghost opened this issue Oct 5, 2016 · 24 comments
Labels
needs: more info Reporter must clarify the issue

Comments

@ghost
Copy link

ghost commented Oct 5, 2016

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

>$ npm install -g [email protected] 
>$ 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.

@JeffBriCR
Copy link

JeffBriCR commented Oct 6, 2016

Same here

/usr/lib/node_modules/angular-cli/node_modules/portfinder/lib/portfinder.js:395
  var interfaces = os.networkInterfaces(),
                      ^

Error: EINVAL: invalid argument, uv_interface_addresses
    at Error (native)
    at /usr/lib/node_modules/angular-cli/node_modules/portfinder/lib/portfinder.js:395:23
    at Object.<anonymous> (/usr/lib/node_modules/angular-cli/node_modules/portfinder/lib/portfinder.js:410:2)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)

@saivarunk
Copy link

Try installing it with sudo user

sudo npm install -g angular-cli

@JeffBriCR
Copy link

Nop. I tried with sudo.

@danvick
Copy link

danvick commented Oct 7, 2016

Same here

@Meligy
Copy link
Contributor

Meligy commented Oct 7, 2016

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?

@ghost
Copy link
Author

ghost commented Oct 7, 2016

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

@filipesilva
Copy link
Contributor

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?

@filipesilva filipesilva added the needs: more info Reporter must clarify the issue label Oct 10, 2016
@ghost
Copy link
Author

ghost commented Oct 10, 2016

yes @filipesilva, I can also install and use other global packages like jshint or typescript. It is too weird...

I've created an ubuntu droplet in DigitalOcean twice and it is still happening.

When I run npm install -g [email protected] the output is ok, but in the npm bin -g folder, ng command is not there.

Content of npm bin -g folder

jshint  node  npm  tsc  tsserver

@ghost
Copy link
Author

ghost commented Oct 10, 2016

the solution is here #1192

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

@ghost ghost closed this as completed Oct 10, 2016
@Christian-Yang
Copy link

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 !

@commercialsuicide
Copy link

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

@iSanchezDev
Copy link

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!

@silva130690
Copy link

Hello ,
my name is Alex Silva, I had the same problem and was resolved using this command sudo npm install --unsafe-perm -g @angular/cli

Thanks you very much

@richard457
Copy link

@silva130690 I am trying your option on ubuntu 16.04 and it is showing that it can not parse JSON as javascript error.

@silva130690
Copy link

silva130690 commented Oct 18, 2017

@richard457 Open terminal and run command whit permission administrator : Sudo ... Script

Understood ?

@makkars
Copy link

makkars commented Dec 5, 2017

Thank you commercialsuicide ..
you have save my day.

@fredlemieux
Copy link

@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.

@narendrasinghrathore
Copy link

It's work after installing globally using the below command
npm install -g angular-cli@version_number

Note: Make sure you have same version of @angulasr/cli as your project has or else it will show warning when building project.

@raafa16
Copy link

raafa16 commented Feb 5, 2019

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!

@khadirck12
Copy link

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!

@meshack-mbuvi
Copy link

I solved this problem by running the following command:
$: echo -e "export PATH=$(npm prefix -g)/bin:$PATH" >> ~/.bashrc && source ~/.bashrc

@oussamasic
Copy link

Hello,
you will find here the steps to Install Angular 9 on Ubuntu 19.10 , 18.04 & 16.04
https://newsanddevelopments.blogspot.com/2020/04/how-to-install-angular-9-on-ubuntu-1804.html

@newguy
Copy link

newguy commented Jun 13, 2020

anybody, i cant install angular on ubuntu 20.4

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators May 14, 2021
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: more info Reporter must clarify the issue
Projects
None yet
Development

No branches or pull requests