4

I am on 12.04LTS. I updated my system today and in that process nodejs got updated. Now my npm has stopped working. For e.g:

$ npm install express                     
npm http GET https://registry.npmjs.org/express
npm http 200 https://registry.npmjs.org/express
npm http GET https://registry.npmjs.org/express/-/express-3.1.0.tgz
npm http 200 https://registry.npmjs.org/express/-/express-3.1.0.tgz
npm ERR! cb() never called!
npm ERR! not ok code 0

Is anyone facing the same issue and knows a fix for this ?

2
  • i'm trying to install brunch and yeoman typing the command npm install -g <packagename> but it fails. I get the same error. Someone suggested to run npm cache clean and try again but it didn't work for me. you may try as well. I'm looking for a solution too.
    – Fabio
    Mar 15, 2013 at 22:44
  • No npm cache clean does not solve the issue for me too. Mar 17, 2013 at 8:04

4 Answers 4

4

Are you using Chris Lea's PPA? This might be helpful: https://chrislea.com/2013/03/15/upgrading-from-node-js-0-8-x-to-0-10-0-from-my-ppa/

Also to note is that the nodejs-dev and npm packages don’t exist anymore. The new nodejs package contains everything that these separate packages used to, because npm needs all the development files, and you’re not really using node these days if you’re not using npm. So we figured we’d just simplify things with the single package.

The upgrade will uninstall the previous versions, but apt can be a bit obstinate about doing this. Instead of the usual

sudo apt-get update
sudo apt-get upgrade

you will probably instead want to do something like

sudo apt-get update
sudo apt-get -y dist-upgrade
1
  • 1
    Yes, I am using chris lea's ppa. I tried out the steps you mentioned above, but it did not work for me :( Mar 17, 2013 at 8:46
3

What you're seeing is an bug occuring in certain combinations of node 0.10 and npm versions before 1.2.15.

As Todd points out, the nodejs Ubuntu package as of 0.10 includes npm. However, since you previously installed npm the "old" way i.e. like any other globally installed npm package, the old version (that exhibits the bug) is still picked up from your $PATH after the upgrade.

Use which npm to find out whether you get the package installed one from /usr/bin/npm. If you're still getting the "old" one, remove it (it's only a symlink) and you'll get the "new" version from the Ubuntu package.

1
  • 1
    I had to remove nodejs, and remove /usr/local/lib/node_modules and relevant symlinks in /usr/local/bin, then re-install nodejs and everything works.
    – badsyntax
    Jun 27, 2013 at 10:40
1

Okay. the issue can be resolved by deleting the .npm and .node-gyp directories from the home folder and then reinstalling nodejs again. I am not sure if this is fullproof but it worked for me :)

1
  • That's not required, it's sufficient to delete the npm binary you installed via npm itself, so the package installed binary is being picked up. Find out which npm is being picked up with which npm.
    – kynan
    May 20, 2013 at 9:04
0

This worked for me. Uninstall npm. Upgrade your install of nodejs.

apt-get remove npm
apt-get install nodejs

You must log in to answer this question.

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