The following packages have unmet dependencies: nodejs : Conflicts: npm

node.jsnpmubuntu-13.04

I followed this gist https://gist.github.com/Goddard/5500157 to install nodejs and npm, but after running it neither node –version or npm –version could be ran, giving an error of command not found. I was able to uninstall nodejs, but had to go into the temp directory described in the script and do a make uninstall to get npm to leave.

Now in an attempt to install nodejs and npm again i used this link instead http://www.andreagrandi.it/2013/02/08/how-to-install-latest-stable-node-js-on-ubuntu/ , but if I try and install both nodejs and npm together I get this error message.

sudo apt-get install nodejs npm

The following packages have unmet dependencies:
   nodejs : Conflicts: npm
E: Unable to correct problems, you have held broken packages.

If I just install nodejs that works fine.

sudo apt-get install nodejs

node --version
v0.10.15

But now if I try to install npm it gives me this error message

sudo apt-get install npm 

The following packages have unmet dependencies:
npm : Depends: nodejs (>= 0.6.19~dfsg1-3) but it is not going to be installed
   Depends: nodejs-dev
   Depends: node-node-uuid but it is not going to be installed
   Depends: node-request but it is not going to be installed
   Depends: node-mkdirp but it is not going to be installed
   Depends: node-minimatch but it is not going to be installed
   Depends: node-semver but it is not going to be installed
   Depends: node-ini but it is not going to be installed
   Depends: node-graceful-fs but it is not going to be installed
   Depends: node-abbrev but it is not going to be installed
   Depends: node-nopt but it is not going to be installed
   Depends: node-fstream but it is not going to be installed
   Depends: node-rimraf but it is not going to be installed
   Depends: node-tar but it is not going to be installed
   Depends: node-which but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I am using Ubuntu 13.04. Any help is appreciated. I dont know much about node.js and npm. I was trying to start learning how to use these so probably my in-experience is showing.

Best Answer

The nodejs package you installed from the PPA includes npm since v0.10.0. Since you have v0.10.15, when you ran sudo apt-get install nodejs you also installed npm. Try to run npm to confirm.

Also see the offical installation guide (the one you followed is a copy of it, but the official one has a few extra details).

Related Topic