Unable to install node-rdkafka. Facing issues with node-gyp

339 views Asked by At

My nodejs application requires kafka-streams library. As far as i know, only the 'kafka-streams' package supports kafka-streams built on top of 'node-rdkafka' package. Hence on trying to run kafka-streams after successfull installation, error poped up asking me to install node-rdkafka first. So, trying to install node-rdkafka now, and am facing issues with node-gyp rebuild.

Below is the exact error when i run the command sudo npm install node-rdkafka

My current version: node - v16.19.0 npm - 8.19.3 node-gyp - v9.4.0

Error:

(base) n0p03px@m-c02f914ymd6n Kafka-Processor % sudo npm install node-rdkafka
npm WARN old lockfile 
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile 
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile 
npm ERR! code 1
npm ERR! path /Users/n0p03px/Documents/My_Projects (new)/Kafka-Processor/node_modules/node-rdkafka
npm ERR! command failed
npm ERR! command sh -c -- node-gyp rebuild
npm ERR! ACTION deps_librdkafka_gyp_librdkafka_target_configure deps/librdkafka/config.h
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | x64
npm ERR! gyp info find Python using Python version 3.9.6 found at "/Applications/Xcode.app/Contents/Developer/usr/bin/python3"
npm ERR! gyp http GET https://nodejs.org/download/release/v16.19.0/node-v16.19.0-headers.tar.gz
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.19.0/node-v16.19.0-headers.tar.gz
npm ERR! gyp http GET https://nodejs.org/download/release/v16.19.0/SHASUMS256.txt
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.19.0/SHASUMS256.txt
npm ERR! gyp info spawn /Applications/Xcode.app/Contents/Developer/usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/Users/n0p03px/.nvm/versions/node/v16.19.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/n0p03px/Documents/My_Projects (new)/Kafka-Processor/node_modules/node-rdkafka/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/n0p03px/.nvm/versions/node/v16.19.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/n0p03px/Library/Caches/node-gyp/16.19.0/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/Users/n0p03px/Library/Caches/node-gyp/16.19.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/Users/n0p03px/.nvm/versions/node/v16.19.0/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/Users/n0p03px/Library/Caches/node-gyp/16.19.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/Users/n0p03px/Documents/My_Projects (new)/Kafka-Processor/node_modules/node-rdkafka',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! /bin/sh: -c: line 0: syntax error near unexpected token `('
npm ERR! /bin/sh: -c: line 0: `LD_LIBRARY_PATH=/Users/n0p03px/Documents/My_Projects (new)/Kafka-Processor/node_modules/node-rdkafka/build/Release/lib.host:/Users/n0p03px/Documents/My_Projects (new)/Kafka-Processor/node_modules/node-rdkafka/build/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../deps; mkdir -p librdkafka; node ../util/configure'
npm ERR! make: *** [deps/librdkafka/config.h] Error 2
npm ERR! gyp ERR! build error 
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/Users/n0p03px/.nvm/versions/node/v16.19.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:201:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)
npm ERR! gyp ERR! System Darwin 22.6.0
npm ERR! gyp ERR! command "/Users/n0p03px/.nvm/versions/node/v16.19.0/bin/node" "/Users/n0p03px/.nvm/versions/node/v16.19.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /Users/n0p03px/Documents/My_Projects (new)/Kafka-Processor/node_modules/node-rdkafka
npm ERR! gyp ERR! node -v v16.19.0
npm ERR! gyp ERR! node-gyp -v v9.1.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/n0p03px/.npm/_logs/2023-10-23T07_40_56_421Z-debug-0.log

(I did try playing around with multiple node and node-gyp versions combinations, but no luck.)

0

There are 0 answers