简体   繁体   English

npm->错误:找不到模块“可读流”

[英]npm --> Err: Cannot find module 'readable-stream'

I have installed node js on my windows 10 machine, and the version is v4.4.2 but when I try to run npm install or even check npm version it throwing the following error. 我已经在Windows 10计算机上安装了Node js,版本是v4.4.2,但是当我尝试运行npm install甚至检查npm版本时,它会抛出以下错误。 Any help would be greatly appreciated 任何帮助将不胜感激

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)

Also, after reading other solutions to this problem, npm install gulp -g, npm install 'readable-stream' or any other suggestion I read and tried did not work. 此外,在阅读了针对该问题的其他解决方案之后,npm install gulp -g,npm install'ready-stream'或我阅读并尝试过的任何其他建议均无效。 It appears any command I try with npm throws the error below. 看来我尝试使用npm的任何命令都会引发以下错误。

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)

I have also tried uninstalling node and reinstalling and same issue persists. 我也尝试过卸载节点并重新安装,同样的问题仍然存在。

I figured it out, when I uninstalld I did not delete all the files. 我发现,卸载后我并未删除所有文件。 There were the node/npm files in my C: directory and failed to realize there were a bunch of npm module files in my / directory. 我的C:目录中有node / npm文件,但未能意识到我的/目录中有一堆npm模块文件。 So after uninstalling and deleting all related files I reinstalled node/npm and it is now working. 因此,在卸载并删除所有相关文件之后,我重新安装了node / npm,现在可以正常工作了。

After all the checks its clear you need to uninstall and re-install node: 经过所有检查后,您需要卸载并重新安装节点:

sudo npm cache clean -f
sudo npm install -g n

sudo n stable // for stable version
sudo n 0.12.7 // for specific version like v0.12.7

// check the node version after install
node -v

如果您在Windows上,请确保在卸载节点后%appdata%或C:\\ Users \\ admin \\ AppData \\ Roaming并删除以前安装在此处创建的所有npm文件夹。

git clone https://github.com/nodejs/readable-stream到全局node_modules文件夹

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM