1

After installing node.js I execute this command:

sudo apt-get install npm

And getting error:

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.
$ sudo apt-get upgrade -f npm node-gyp
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... 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:
  nodejs-dev : Depends: libssl-dev (>= 1.0.0g) but it is not going to be installed
E: Broken packages
David Foerster
  • 36,890
  • 56
  • 97
  • 151
sadia
  • 151

2 Answers2

4

After facing numerous errors, finally get success to resolve the issues. Here are the steps I followed.

First I installed "curl" by following http://sourcedigit.com/20782-install-curl-ubuntu-via-command-line/ . This article provides two ways to install curl and I successfully installed curl using "Alternate Method To Install Curl".

Then I executed commands in sequence

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install nodejs

By executing above nodejs command, node js version 8 is installed with npm version 5.3.0

David Foerster
  • 36,890
  • 56
  • 97
  • 151
sadia
  • 151
1

add python libraries for that:

sudo apt-get install python-software-properties

add the ppa for latest nodejs with this command :

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -

then try :

sudo apt install -y nodejs

I hope this will work for you, because this works for me.

Deki
  • 655