Error: Cannot find module wrappy npm installation

When installing Node.js on Windows 10 Pro 64 bit(or other Windows operating systems), you may experience a strange error like the one below when you type “npm -v” in the command line tool.

module.js:471
  throw err;
  ^

Error: Cannot find module 'wrappy'
  at Function.Module._resolveFilename (module.js:469:15)
  at Function.Module._load (module.js:417:25)
  at Module.require (module.js:497:17)
  at require (internal/module.js:20:19)
  at Object. (C:\Users\Benny\AppData\Roaming\npm\node_modules\npm\node_modules\once\once.js:1:76)
  at Module._compile (module.js:570:32)
  at Object.Module._extensions..js (module.js:579:10)
  at Module.load (module.js:487:32)
  at tryModuleLoad (module.js:446:12)
  at Function.Module._load (module.js:438:3)

After spending days on this and pulling our hair, I decided to post a solution on our blog!

Please leave us a message if this solution worked for you.

Why the problem occurs at the first place

This error shows up because you have installed a new npm version over an old one. You would think that the node.js installation would remove all the npm installation folders and files from your computer but it is simply not happening!

Solving the bug

To solve this error, first, uninstall node.js, then write

“%AppData% in the search bar of windows 10(at the bottom left of your screen).

This command will open a folder called “Roaming”.

When inside the Roaming folder, look for 2 folders called “npm” and “npm-cache”, simply delete both of them.

Restart your computer and redownload node.js.

Install both node.js and npm as usual and restart your computer one more time.

When the computer is restart, simply type this command in your cmd.exe:

node -v

and

npm -v

Both commands should now work

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Disclaimer:

As an Amazon Associate I earn from qualifying purchases. This post may contain affiliate links which means I may receive a commission for purchases made through links.