I'm getting the following error when trying to run npm install node-rdkafka on Mac High Sierra. I've found a number of similar issues around the node-gyp rebuild but none that match this one. Any ideas?
gcc -MD -MP -gstrict-dwarf -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align -c rdkafka_lz4.c -o rdkafka_lz4.o
rdkafka_lz4.c:32:10: error: 'lz4frame.h' file not found with
^~~~~~~~~~~~
"lz4frame.h"
1 error generated.
make[2]: * [rdkafka_lz4.o] Error 1
make[1]: [libs] Error 2
make: ** [_Users_xxx_workspace_electron_myfirstelectron_node_modules_node_rdkafka_deps_librdkafka_gyp_librdkafka_target_build_dependencies.intermediate] Error 2
rm _Users_xxx_workspace_electron_myfirstelectron_node_modules_node_rdkafka_deps_librdkafka_gyp_librdkafka_target_build_dependencies.intermediate
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:258:23)
gyp ERR! stack at ChildProcess.emit (events.js:180:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)
gyp ERR! System Darwin 17.4.0
gyp ERR! command "/usr/local/Cellar/node/9.8.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/xxx/workspace/electron/myfirstelectron/node_modules/node-rdkafka
gyp ERR! node -v v9.8.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
Do you have LZ4 installed on your machine? Can you check the output of pkg-config to see?
@natemccallum I had the same issue on Sierra 10.12.5. The problem was not present on my Linux machine. Dug a little deeper and found I can even build librdkafka manually in Sierra outside of node-gyp :
cd deps/librdkafka
./configure
make
...success
Which is interesting...
After searching around, looks like it's a configuration issue related to xcode. See below :
Check Original Setting (-p prints the current setting)
xcode-select -p
/Applications/Xcode.app/Contents/Developer
Make sure to keep a copy of the original setting in case this change doesn't work for you (or makes things worse) and you need to change it back.
Change it to /Library/Developer/CommandLineTools with the following command
sudo xcode-select --switch /Library/Developer/CommandLineTools
Run npm install again and it worked for me. Good luck.
Reference that got me going the right direction : https://crystal-lang.org/docs/installation/on_mac_osx_using_homebrew.html
@natemccallum: does @carpassgeek's solution fix your problem?
I will test next week when I’m back from holiday. Thanks
On Fri, Mar 30, 2018 at 9:29 AM Stephen Parente notifications@github.com
wrote:
@natemccallum https://github.com/natemccallum: does @carpassgeek
https://github.com/carpassgeek's solution fix your problem?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Blizzard/node-rdkafka/issues/382#issuecomment-377563618,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFuc1Mq879cum2Etyq2_-i9KSTGDDxMvks5tjl2CgaJpZM4S0F73
.
@carpassgeek Thank you for the suggestion this worked like a charm. I was able to install now without errors. Thanks.
Most helpful comment
@natemccallum I had the same issue on Sierra 10.12.5. The problem was not present on my Linux machine. Dug a little deeper and found I can even build librdkafka manually in Sierra outside of node-gyp :
Which is interesting...
After searching around, looks like it's a configuration issue related to xcode. See below :
Check Original Setting (-p prints the current setting)
Make sure to keep a copy of the original setting in case this change doesn't work for you (or makes things worse) and you need to change it back.
Change it to /Library/Developer/CommandLineTools with the following command
Run
npm installagain and it worked for me. Good luck.Reference that got me going the right direction : https://crystal-lang.org/docs/installation/on_mac_osx_using_homebrew.html