FredericHeem / rabbitmq-pubsub

RabbitMQ Publisher Subscriber in Node.js
12 stars 5 forks source link

pub sub throwing warning and error #4

Open sanfx opened 6 years ago

sanfx commented 6 years ago

By doing

var Subscriber = require('rabbitmq-pubsub').Subscriber;

_warning in ./node_modules/_colors@1.0.3@colors/lib/colors.js

127:29-43 Critical dependency: the request of a dependency is an expression_

"[WDS] Warnings while compiling." "./node_modules/_colors@1.0.3@colors/lib/colors.js 127:29-43 Critical dependency: the request of a dependency is an expression @ ./node_modules/_colors@1.0.3@colors/lib/colors.js @ ./node_modules/_colors@1.0.3@colors/safe.js @ ./node_modules/_winston@1.1.2@winston/lib/winston/config.js @ ./node_modules/_winston@1.1.2@winston/lib/winston.js @ ./node_modules/_logfilename@0.1.3@logfilename/src/logfilename.js @ ./node_modules/rabbitmq-pubsub/build/subscriber.js @ ./node_modules/rabbitmq-pubsub/build/index.js @ ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/components/SelectServices.vue @ ./src/components/SelectServices.vue @ ./src/main.js @ multi (webpack)-dev-server/client?http://10.9.1.147:8081 webpack/hot/dev-server ./src/main.js"

but when I did this :


var subscriberOptions = {
  exchange: 'service_deployment_exchange',
  queueName: queue,
  url: amqpl_url
};

var subscriber = new Subscriber(subscriberOptions);
function onIncomingMessage(message) {
  debug('onIncomingMessage ', message.fields);
  console.log(message);

  subscriber.ack(message);

  //subscriber.nack(message);
};

and call the below line in the mounted function in the script element of of my vue single file complonent subscriber.start(onIncomingMessage)

I get

TypeError: fs.readdirSync is not a function

beside just the warning still showing up in console.

FredericHeem commented 6 years ago

This lib is intended to run on Node, not in the browser.