Solvednode rdkafka Error during compilation

Hello guys,

I try to install node-rdkafka

$ npm i node-rdkafka

And get the following error

CC(target) Release/obj.target/librdkafka/deps/librdkafka/src/rdkafka_sasl.o
../deps/librdkafka/src/rdkafka_sasl.c:35:23: fatal error: sasl/sasl.h: Aucun fichier ou dossier de ce type
 #include <sasl/sasl.h>
                       ^
compilation terminated.
deps/librdkafka.target.mk:147: recipe for target 'Release/obj.target/librdkafka/deps/librdkafka/src/rdkafka_sasl.o' failed
make: *** [Release/obj.target/librdkafka/deps/librdkafka/src/rdkafka_sasl.o] Error 1
make: Leaving directory '/home/tristan/Documents/node_modules/node-rdkafka/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 3.16.0-4-amd64
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/tristan/Documents/node_modules/node-rdkafka
gyp ERR! node -v v7.4.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok

I use node 7.4.0 and npm 4.0.5

4 Answers

✔️Accepted Answer

Hi @Rick83600 have you got libsasl2-dev installed on your system ?

More Issues: