13

I'm trying to install nodejs and npm, however, it fails. This is my terminal:

sudo apt-get install nodejs npm
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:
nodejs : Conflicts: npm
E: Unable to correct problems, you have held broken packages.

What to do? I'm kinda lost :(

3 Answers3

14

Just execute this commands!

Installing Node.js via :

sudo apt-get install -y python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

Check version:

$ npm -v
1.4.9
$ node -v
v0.10.28

For more info visit this guide.

4

Sounds like you have one of the nodejs PPAs installed. One I use has npm distributed as part of the nodejs package and it's impossible and unneccessary to install both.

Install nodejs and see if you can run npm.

Oli
  • 299,380
0

You should follow the Node.js guide

curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs
barbolo
  • 213
  • 1
  • 2
  • 7