Properly Cleaning and Reinstalling NPM on Windows

Published by Berkan K. on November 30

book 3 min read

At some point, I completely broke my Node.js and npm setup on Windows. Commands stopped working, paths were weird, and reinstalling on top of it did absolutely nothing.

When npm gets messed up like this, the only real fix is to wipe everything and start fresh. This is what a proper clean reinstall looks like on Windows.

Uninstalling Node.js and npm

  1. Uninstall Node.js from Programs & Features using the normal uninstaller.

  2. Remove any shortcuts related to Node or npm from your desktop or taskbar.

  3. Delete the following folders if they exist:

C:\Program Files (x86)\Nodejs
C:\Program Files\Nodejs
C:\Users\{User}\AppData\Roaming\npm
C:\Users\{User}\AppData\Roaming\npm-cache
C:\Users\{User}\.npmrc

Also check if .npmrc exists without the dot.

  1. Open Environment Variables and remove any Node.js or npm entries from the Path.

  2. Open Command Prompt and run:

where node

If it still shows any paths, delete those folders manually.

  1. Reboot your computer. Don’t skip this.

  2. Download Node.js again from the official site and install it.

Installing Node.js and npm

Download Node.js from the official site: https://nodejs.org/en/download/

Choose the 64-bit LTS version. LTS is the stable one and what you want unless you have a very specific reason not to.

Step 1

Once downloaded, open the installer.

Step 2

Click Next on the welcome screen.

Choose the install location if you care. Default is fine for most people.

Step 3

On the feature selection screen, make sure npm package manager is selected. The defaults are fine:

  • Node.js runtime
  • npm package manager
  • Add to PATH
Step 4

Click Install and let it finish.

Step 5

Verify the install

Open Command Prompt and run:

node -v

Then:

npm -v

If both return versions, you’re done.

This gives you a genuinely clean Node and npm setup without leftover paths, broken caches, or weird ghost installs. If npm ever goes completely off the rails on Windows again, this fixes it every time.

NPM Logo
Author
profile
Hello, I'm a 25-year-old Software Engineer based in Denmark, specializing in Cybersecurity and
Fullstack Development.

Beyond programming, I enjoy sharing my journey and insights through writing, aiming to contribute to the tech community and inspire like-minded professionals.

Post Details Category