0

Whenever I type any NPM command, I get this error:

C:\Program Files (x86)\Microsoft Visual Studio 14.0>npm -v
internal/modules/cjs/loader.js:582
    throw err;
    ^

Error: Cannot find module 'os-tmpdir'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
    at Function.Module._load (internal/modules/cjs/loader.js:506:25)
    at Module.require (internal/modules/cjs/loader.js:636:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (C:\Users\*I like my privacy*\AppData\Roaming\npm\node_modules\npm\node_modules\osenv\osenv.js:4:16)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)

I've tried reinstalling node, but I keep getting that same error. I've noticed that if I search NPM in the "add or remove programs" page in settings, I get no results, if that's useful.

My version of Node is v10.13.0
I'm using Windows 10 Home, version 1803

F4Tornado
  • 183
  • 2
  • 14

1 Answers1

1

I would remove node: How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)

And then reinstall it with NVM: https://github.com/creationix/nvm like this:

> nvm install 8.9.1
> nvm list  // Will show you available NodeJS distribution
>    8.9.1
// So tell nvm to use your version
> nvm use 8.9.1
> nvm list
>    * 8.9.1 (Currently using 64-bit executable)
> node -v
> 8.9.1
Rafaël Moser
  • 114
  • 1
  • 8
  • I use Windows 10, so I had to use these links instead: https://stackoverflow.com/questions/20711240/how-to-completely-remove-node-js-from-windows https://github.com/coreybutler/nvm-windows – F4Tornado Nov 15 '18 at 20:54
  • Ok, and did it work? Did you use NVM to reinstall it? – Rafaël Moser Nov 16 '18 at 09:28