Fixing a broken node.js install in Windows

Node.js has been a great evolution for javascript – but if you’ve worked with it in Windows, you’ve probably ran into problems running the commands – whether it be missing or locked files, missing modules, etc.

I wanted to post my process which normally fixes these issues for me.

First off – the first thing you should always try first is to delete your node_modules folder and clean the cache:

# Once you've deleted your node_modules folder in your project..
npm cache clean
npm install

I usually uninstall Node from my system and reinstall the latest version, as well as delete the node_modules package from the project which I’m having the troubles with.

  • Uninstall Node.js in your programs
  • Delete c://users//username//AppData/Roaming//npm
  • Delete c://users//username//AppData/Roaming//npm-cache
  • Open your environment variables and delete all references to node.js / npm

Once everything is uninstalled and the machine is clean, go and and download and reinstall node. Keep in mind you’ll need to reinstall all global node packages like gulp, bower – etc.

You can verify your versions of node.js:

# Check your node.js version
node -v
# Check your npm version
npm -v