How to upgrade node.js on Windows?


I already have Node.js v0.8.0 running on Windows. Can I just run the latest installer to upgrade it to v0.8.4? I am afraid it will break existing third party modules on my machine.

7/28/2012 7:36:34 AM

Accepted Answer

Yes, you just install the latest version. Generally you shouldn't have any compatibility problems if you are already using the same major version (e.g. Version 0.8.x). If you are concerned about changes, you can always check the changelog for each version (link to changelog is on node.js download page at That should tell you of any big changes (i.e API changes, etc).

7/28/2012 10:30:43 AM

For the record, I have just gone through the process, and it is painless even if you upgrade to another major version.

I have moved from 0.8 to 0.10, using the .msi package, overwriting the one installed on my system. Package problems were all fixed with npm update -g. Worked like a charm.

In case it does not work like a charm:

npm cache clean usually fixes the problem. Once the cache is empty, just run npm update -g again.

In case you really run into trouble:

Delete the modules you have installed globally, then reinstall them. Here's how:

  • Take stock of what you have: npm list -g --depth=0 lists all top-level packages, with version numbers. npm list -g --parseable --depth=0 > npm-global-modules.txt writes them to a file in your cwd.

    Any strange stuff you didn't install yourself has probably been installed by another module (rare, but I have seen it happen). Remove those modules from the list. Also remove the module "npm".

  • In an editor, format the output for the command line by replacing \n?[^\n]+[\\/] (regex) with a single space.

    (I didn't get this to work with findstr in a pipe, hence the roundtrip to the editor. You can also do it manually, of course ;)

  • Delete all modules. On Windows, delete (or rename) the %appdata%\npm directory. For other OS, see Command to remove all npm modules globally?

  • Reinstall the modules with npm install -g [your module list here]. Don't forget to npm cache clean before you do it.

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow