【发布时间】:2016-06-17 03:53:30
【问题描述】:
我一直在使用 Google 和 StackOverflow,查看与类似问题相关的各种线程,但到目前为止没有任何效果。我的问题是 npm 似乎安装不正确......或者什么,我真的不知道:Node 和 npm 是我用来支持我在另一台机器上工作的 Sage Wordpress 主题构建的依赖项。
所以问题是在卸载 Node(为了安全起见)并重新安装之后,Node 似乎工作正常。 node -v 返回 v5.1.0。伟大的。 npm 应该与它一起安装,但是当我运行 npm -v 时,我得到了以下可爱的错误:
$ npm
module.js:340
throw err;
^
Error: Cannot find module 'readable-stream'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:289:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/Users/Daniel/.nvm/versions/node/v5.1.0/lib/node_modules/npm/node_modules/ npmlog/node_modules/are-we-there-yet/index.js:2:14)
at Module._compile (module.js:425:26)
at Object.Module._extensions..js (module.js:432:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:313:12)
at Module.require (module.js:366:17)
运行任何 npm 命令(即使只是 npm)都会给我这个错误,所以正如其他解决方案中所建议的,我不能简单地运行 npm install readable-stream。我也经历了各种解决方案(删除 node_modules 文件夹,通过 brew 安装,通过没有 npm 的 brew 安装,以及其他几个),但似乎都没有工作。
任何想法将不胜感激。
【问题讨论】:
-
在重新安装之前你有没有运行
npm cache-clean -
@adeneo 否定。让我再试一次
-
你在enter link description here的答案,你应该在发布问题之前研究一下。
-
@DinhNC 根据我的问题,这不起作用。我确实看到了那个帖子,但它并没有解决我的问题。
-
你有没有运行过“npm install gulp -g”这一行?