I recently updated both node and npm on my computer. This introduced some problems for me and I thought I would write down the solution that I found, in case anyone else has the same problem. It was not obvious to me and googling it did not really reveal any great results (or maybe I just used the wrong phrase).

So here’s what happened: After updating node and npm, I wanted to install yeoman:

npm install -g yo

This produced a whole lot of errors:

npm ERR! Windows_NT 6.1.7601
npm ERR! argv ”node” ”C:\\Users\\blabla\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js” ”install” ”-g” ”yo”
npm ERR! node v0.12.5
npm ERR! npm v2.12.0

npm ERR! undefined is not a function
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR! D:\blah\bleh\npm-debug.log

Wow. I have no idea what that means other than something went terribly wrong. The npm logfile confirmed the errors but I was still not sure what the root cause was. After some failed attempts att googling, I was left with my brain. Yeah, that guy.

Printing the node and npm versions (node -v and npm -v) revealed that they seemed to have been updated successfully, so what else? Is yeoman not compatible with any of these versions? It’s a very popular package, so surely they would have fixed it straight away it anyone stumbled upon this issue. For now, I will assume that the problem is elsewhere.

So if the newly updated software is not the problem, then maybe something old is. Something that lingers. A cache. Is there a cache? There is an npm cache and you can clean it like this:

npm cache clean

..and then yeoman could be successfully installed. Hope it helps if anyone is having this (or a similar) problem.