Error installing npm

0 votes

I am trying to install npm with the following command:

sudo apt-get install npm​

But I am getting this error:

The following packages have unmet dependencies:
 npm : Depends: nodejs but it is not going to be installed
       Depends: node-abbrev (>= 1.0.4) but it is not going to be installed
       Depends: node-ansi but it is not going to be installed
       Depends: node-archy but it is not going to be installed
       Depends: node-block-stream but it is not going to be installed
       Depends: node-fstream (>= 0.1.22) but it is not going to be installed
       Depends: node-fstream-ignore but it is not going to be installed
       Depends: node-github-url-from-git but it is not going to be installed
       Depends: node-glob (>= 3.1.21) but it is not going to be installed
       Depends: node-graceful-fs (>= 2.0.0) but it is not going to be installed
       Depends: node-inherits but it is not going to be installed
       Depends: node-ini (>= 1.1.0) but it is not going to be installed
....
Feb 8 in Linux Administration by Sharan
63 views

1 answer to this question.

0 votes

Npm depends on NodeJS to run/get installed. The error you are getting is because you are trying to install npm without installing the package it depends on (NodeJS). You will have to install NodeJS first. 

To install NodeJS, run:

$ sudo apt-get install nodejs

and then install npm:

$ sudo apt-get install npm
answered Feb 8 by Omkar
• 67,660 points

Related Questions In Linux Administration

0 votes
1 answer
0 votes
1 answer

"connect: Network is unreachable?" error on ping

You need to set your default gateway. ...READ MORE

answered Jan 23 in Linux Administration by Tina
639 views
0 votes
1 answer

How to check version of package installed by npm?

These commands are used to check the ...READ MORE

answered Feb 4 in Linux Administration by Omkar
• 67,660 points
95 views
0 votes
1 answer
0 votes
1 answer

how to safely deploy npm install without it causing inconsistencies?

The recent versions on npm generates a ...READ MORE

answered Apr 11, 2018 in DevOps on Cloud by DareDev
• 6,810 points
68 views
0 votes
1 answer

How do I set variable if a specific package version is installed in CFEngine?

Here is what you can do.Just use packagesmatching to ...READ MORE

answered Jul 12, 2018 in Other DevOps Questions by Atul
• 10,240 points
91 views
0 votes
1 answer

Install postgreSQL on Ubuntu

Installing PostgreSQL on Ubuntu is very simple, ...READ MORE

answered Mar 22 in Database by Nitesh
60 views
+2 votes
2 answers

Ubuntu installing problem

Hey Prince! This seems to be like a ...READ MORE

answered Oct 15, 2018 in Linux Administration by Omkar
• 67,660 points

edited Oct 15, 2018 by Kalgi 59 views
+1 vote
1 answer

Not able to install npm on Ubuntu

Try installing npm using aptitude: sudo apt install aptitude sudo ...READ MORE

answered Nov 28, 2018 in Linux Administration by Omkar
• 67,660 points
1,905 views