I got this message when trying to update nodejs and nodejs-dev (with --with-new-pkgs option) in Ubuntu 18.04.

 The following packages have unmet dependencies:
 libssl-dev : Conflicts: libssl1.0-dev but 1.0.2n-1ubuntu5.1 is going to be installed
              Recommends: libssl-doc but it is not going to be installed
 libssl1.0-dev : Conflicts: libssl-dev but 1.1.0g-2ubuntu4.1 is going to be installed
E: Broken packages 

1 Answer 1


Use n module from npm in order to upgrade node

sudo npm cache clean -f
sudo npm install -g n
sudo n stable

To upgrade to latest version (and not current stable) version, you can use

sudo n latest

To undo:

sudo apt-get install --reinstall nodejs-legacy     # fix /usr/bin/node
sudo n rm 6.0.0     # replace number with version of Node that was installed
sudo npm uninstall -g n
  • Make sure you've opened a new terminal window before node -v Oct 12, 2020 at 20:15

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