未捕获的TypeError:__ webpack_require __(...)。connect不是Object.connect上connect(index.js:47532)的函数(

时间:2017-08-29 10:15:39

标签: reactjs rabbitmq rpc

我收到此错误

Img

当我尝试在反应项目上测试代码时:

var amqp = require('amqplib/callback_api');


export function start2 (conn) {

console.log("hello")

amqp.connect('amqp://localhost:8000', function (err, conn) {

    conn.createChannel(function(err, ch) {
        var q = 'frontend';
        var msg = 'Hello!';

        ch.assertQueue(q, {durable: false});
        // Note: on Node 6 Buffer.from(msg) should be used
        ch.sendToQueue(q, new Buffer(msg));
        console.log(" [x] Sent %s", msg);
    });
    setTimeout(function() { conn.close(); process.exit(0) }, 500);



});

}

任何帮助请和谢谢。

0 个答案:

没有答案