扔错了;错误:找不到模块'node-rdkafka'

时间:2018-01-28 12:41:18

标签: node.js apache-kafka

这是我的追溯:

我正在尝试运行一个使用apache-kafka作为简单消息传递的项目 队列,具有单个生产者 - 经纪人 - 消费者。但是,我有kafka_2.12-0.11.0.0版本。

domain = "www.example.com"
obj = Jornal.objects(domain = domain)

我已经通过在此目录中打开终端尝试了this post中提到的解决方案:

Error: Cannot find module 'node-rdkafka'
at Function.Module._resolveFilename (module.js:326:15)
at Function.Module._load (module.js:277:25)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/junaid/eMumba/CASB/git/casb-cleansers/server/index.js:2:1)
at Module._compile (module.js:410:26)
at loader (/home/junaid/eMumba/CASB/git/casb-cleansers/node_modules/babel-register/lib/node.js:144:5)
at Object.require.extensions.(anonymous function) [as .js] (/home/junaid/eMumba/CASB/git/casb-cleansers/node_modules/babel-register/lib/node.js:154:7)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)

npm ERR! Linux 4.4.0-112-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! node v4.2.6
npm ERR! npm  v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! a10-casb-cleanser@1.0.0 start: `babel-node ./server/index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the a10-casb-cleanser@1.0.0 start script 'babel-    node ./server/index.js'.
npm ERR! Make sure you have the latest version of node.js and npm     installed.
npm ERR! If you do, this is most likely a problem with the a10-casb-    cleanser package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     babel-node ./server/index.js
npm ERR! You can get information on how to open an issue for this     project with:
npm ERR!     npm bugs a10-casb-cleanser
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls a10-casb-cleanser
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/junaid/eMumba/CASB/git/casb-cleansers/npm-debug.lo

并在终端:

/home/junaid/eMumba/CASB/git/casb-cleansers/server/

运行上述命令后回溯:

npm install --save node-rdkafka

如果有人可以帮我这个。我一直试图解决这个问题已经有一段时间了,谢谢。

1 个答案:

答案 0 :(得分:-1)

这有时会发生在npm和缓存中。

务必运行:

  • rm -rf node_modules
  • npm install
  • npm install --save node-rdkafka