I want to install npm. I've updated everything but I can't fix the problem.

The message I get is:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 npm : Depends: node-gyp (>= 0.10.9) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Could you help me?

  • 1
    Run sudo apt install -f to fix the dependencies! Oct 30, 2018 at 18:14
  • Bugs are reported already: bugs.launchpad.net/ubuntu/+source/npm/+bug/1517491 and bugs.launchpad.net/ubuntu/+source/npm/+bug/1809828 . put a reference there to here. please mark yourself as affected if so. thank you Dec 5, 2019 at 8:50

1 Answer 1


I was able to install npm by doing following:

sudo apt-get install nodejs-dev node-gyp libssl1.0-dev


sudo apt-get install npm
  • 8
    This is what fixed it, you rock
    – bhappy
    Feb 21, 2019 at 8:25
  • 3
    had issues on ubuntu 18.04 where nodejs installed but not npm, this fixed my problems
    – Manny265
    Mar 26, 2019 at 10:49
  • 10
    To anyone applying this solution: make sure you review the changes before applying them, as it might remove some installed packages to resolve dependencies. In my case, Jasp and a couple more packages were removed in the process.
    – stragu
    Jun 2, 2019 at 11:50
  • 8
    Ubuntu 18.04:The following packages will be REMOVED: libcurl4-openssl-dev libssl-dev
    – rcpa0
    Jun 11, 2019 at 17:45
  • 8
    Works, but it uninstalled a lot of installed packages like the whole of ros-melodic. Feb 20, 2020 at 10:26

Not the answer you're looking for? Browse other questions tagged .