简体   繁体   English

如何解决错误:找不到模块'kue'

[英]how to solve Error: Cannot find module 'kue'

I am getting started on kue job queue an i am trying out if my producer works 我正在开始执行kue工作队列,如果我的制片人工作,我正在尝试

producer.js producer.js

var kue = require('kue')
, redis = require('redis');

  kue.redis.createClient = function() {
    var client = redis.createClient(6379, '127.0.0.1');
    client.auth('');
    return client;
  };
  var jobs = kue.createQueue();

var sequence = 0;

setInterval(
  function() {
  sequence += 1;
  (function(sequence) {
  var job = jobs.create('email',{
  title: 'Hello #' + sequence
  ,to: 'whatemail@gmail.com'
  ,body: 'Hello from node!'
  }).save();

  job.on('complete', function(){
  console.log('job ' + sequence + ' completed!')
  });

  job.on('failed', function() {
  console.log('job ' + sequence + 'failed!')
  });
  })(sequence);
  }
  ,1000);

I however get the error Error: Cannot find module 'kue'.I however have installed kue globally. 但是我得到了错误错误:找不到模块'kue'。但是我已经全局安装了kue。

This is the error 这是错误

C:\kueapps>node producer.js

module.js:340
    throw err;
          ^
Error: Cannot find module 'kue'
    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> (C:\kueapps\producer.js:1:73)
    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 Function.Module.runMain (module.js:497:10)

You'll need to run 你需要跑步

npm install kue

You could also ad the --save switch to the command, to save the dependency in your package.config file 您也可以将--save开关广告到命令,以将依赖项保存在package.config文件中

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

相关问题 如何解决错误:找不到模块“ejs”? - How to solve Error : cannot find module "ejs"? 如何解决此错误:找不到模块“ibm-watson” - How to solve this Error: Cannot find module 'ibm-watson' 如何解决错误:找不到模块&#39;json-parse-helpfulerror&#39; - How to solve error: Cannot find module 'json-parse-helpfulerror' 如何解决Node.js错误:找不到模块? - How to solve Node.js Error: Cannot find Module? 如何解决错误信息“找不到模块'缩写' - How to solve error message "Cannot find module 'abbrev' 如何在Node.js中的Redis的Kue模块中管理TTL超出错误? - How to manage TTL exceeded error in kue module of Redis in nodejs? 如何解决 angular 错误“发生未处理的异常:找不到模块'typescript'”? - How to solve angular error "An unhandled exception occurred: Cannot find module 'typescript' "? 如何解决错误:在 express js 上使用路由器时找不到模块“./routes/products” - how to solve Error : Cannot find module './routes/products' while using router on express js 如何解决错误:在 Express JS 中找不到模块“express-rate-limit”? - How to solve the error: Cannot find module 'express-rate-limit' in Express JS? 如何解决节点 js 终端中的“找不到模块”? - How to solve "Cannot find module" in node js terminal?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM