4

So I had removed node from my computer (mostly, I thought) a couple months ago, and today I reinstalled it. Node's working okay, but when I try to test npm I get this message:

$ npm
module.js:549
    throw err;
    ^

Error: Cannot find module 'internal/util/types'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at evalmachine.<anonymous>:31:26
    at Object.<anonymous> (C:\Users\LG\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\fs.js:11:1)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)

I tried using "npm rebuild" as I've seen suggested, but that has no impact on anything. I'm using Node v8.11.2 on Windows (hell if I know what version of NPM). Any clues?

L.C.J
  • 2,993
  • 4
  • 15
  • 16

4 Answers4

12

In windows,

  • Step 1: Go to \global_modules\node_modules, (C:\Users\youruser\AppData\Roaming\npm ) (C:\Users\youruser\AppData\Roaming\npm-cache)

  • Step 2: Delete the "npm" folder and all its contents,

  • Step 3: Go to https://nodejs.org,

  • Step 4: Download the "Recommended For Most Users" version),

  • Step 5: Install it

Sajeetharan
  • 216,225
  • 63
  • 350
  • 396
3

For me this worked.

delete package-lock.json

npm i graceful-fs
npm i vinyl-fs
cbyte
  • 681
  • 7
  • 12
2

From your terminal, run

rm -rf ./node_modules

npm update

npm install npm@latest -g 

or

sudo npm install npm@latest -g

These should help fix your problem.

antzshrek
  • 9,276
  • 5
  • 26
  • 43
0

Had this same problem. Solved it by going to %AppData% and deleting npm and npm-cache folders.

Mandemon
  • 372
  • 3
  • 22