Node.js找不到模块“可读流" [英] Node.js cannot find module 'readable-stream'

查看:140
本文介绍了Node.js找不到模块“可读流"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是node.js的新手,并坚持以下内容.任何帮助将不胜感激:

I am new to node.js and stuck on the following. Any help will be appreciated:

我正在Ubuntu(12.10)上运行node.js(0.10.28).我正在处理的代码是:

I am running node.js (0.10.28) on ubuntu (12.10). The code I am working on is:

"use strict";

var  mysql = require('node-mysql'),
connection = mysql.createConnection({
    host: "127.0.0.1",
    user: "user",
    password: "password",
    database: "dbname"
});
    if(connection) { 
    console.log("Query");
    connection.query("select * from client",function(err,res) {
    if(err)console.log(err);
    console.log(res);
});
}   

我收到以下错误

Error: Cannot find module 'readable-stream'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/root/RonakNodeEmail/node_modules/node-mysql/lib/protocol/sequences/Query.js:7:20)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)

推荐答案

我很长一段时间都收到了此错误.愚蠢的我还没有安装gulp ...简而言之,当缺少软件包时,就会发生此问题.

I got this error for the a long while. Stupidly I hadn't installed gulp... In short this problem occurs when a package is missing.

npm install gulp -g

我建议找出正在运行的任务,然后再安装.

I would suggest working out which task you are running and then install that.

这篇关于Node.js找不到模块“可读流"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆