Npm version shows Error: cannot find module 'readable-stream'

I installed node js on my Windows 7 computer and the version appears as v4.1.2, but when I try to run npm install or even check the npm version, it throws the following error. Can someone help me where the problem is?

C:\Users\nmadasu>npm version
module.js:338
    throw err;
    ^

Error: Cannot find module 'readable-stream'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:286:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (C:\Users\nmadasu\AppData\Roaming\npm\node_modules\npm
\node_modules\are-we-there-yet\index.js:2:14)
    at Module._compile (module.js:434:26)
    at Object.Module._extensions..js (module.js:452:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)

After reading SO ( Node.js cannot find the 'readable-stream' module ), I tried npm install gulp -g, even this also gave the same error.

C:\Users\nmadasu>npm install gulp -g
module.js:338
    throw err;
    ^

Error: Cannot find module 'readable-stream'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:286:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (C:\Users\nmadasu\AppData\Roaming\npm\node_modules\npm
\node_modules\are-we-there-yet\index.js:2:14)
    at Module._compile (module.js:434:26)
    at Object.Module._extensions..js (module.js:452:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
+3
source share
3 answers

Try:

npm install -g readable-stream

Thereafter:

npm install gulp -g

+2
source

If you can not do

npm install gulp -g

because you always have: "Unable to find the module" readable-stream ""

then do:

sudo apt-get install npm
+1

For me on Windows, a unique process that works removes these folders

C: \ Users \ YOURUSER \ AppData \ Roaming \ NPM C: \ Users \ YOURUSER \ AppData \ Roaming \ NPM Cache and reinstall nodejs downloaded from the official site

I hope this help others: D

0
source

All Articles