Node-rdkafka: Install fail during node-gyp rebuild

Created on 18 Oct 2017  ยท  22Comments  ยท  Source: Blizzard/node-rdkafka

Hi, I would like to install node-rdkafka but I always get the same error (tried a lot of different versions) .
I'm currently on node 8.6, but also tried 7.10 and 6.10.

It looks like the problem happens when the "make" command is executed, because a directory already exist. But I don't see why it says it to me.

Does someone has an idea ?

LOG: log.txt

installation issues stale

Most helpful comment

For everyone else having problems installing [email protected] on macOS Sierra:

Error:

ld: library not found for -lcrypto
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Release/node-librdkafka.node] Error 1

Fix:

โ‡’  brew install openssl
โ‡’  echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.zshrc
โ‡’  echo 'export LDFLAGS="-L/usr/local/opt/openssl/lib"' >> ~/.zshrc
โ‡’  echo 'export CPPFLAGS="-I/usr/local/opt/openssl/include"' >> ~/.zshrc
-  reload terminal
โ‡’  npm i node-rdkafka

NOTE:
I am using Z shell. Make sure you replace ~/.zshrc with whatever shell you're using

All 22 comments

Can you purge the node modules directory and try to install again?

Hi, I already tried it a lot of time without any result :(

This directory looks pretty strange to me: './-dnode_gyp_module_name=librdkafka'. Can you run a find in your project directory to search all subfolders for anything with the name .*librdkafka.*?

Okay i'll try as soon as I can, I don't have my pc atm

Okay I did it and found nothing

I've been trying to install for two hours, unsuccessfully so far

npm install node-rdkafka --save

> [email protected] install D:\LAB\MaisVendidoPorHora\src\obter-mais-vendido-por-hora\node_modules\node-rdkafka
> node-gyp rebuild


D:\LAB\MaisVendidoPorHora\src\obter-mais-vendido-por-hora\node_modules\node-rdkafka>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
Traceback (most recent call last):
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py", line 16, in <module>
    sys.exit(gyp.script_main())
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 545, in script_main
    return main(sys.argv[1:])
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 538, in main
    return gyp_main(args)
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 514, in gyp_main
    options.duplicate_basename_check)
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 130, in Load
    params['parallel'], params['root_targets'])
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 2778, in Load
    variables, includes, depth, check, True)
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 420, in LoadTargetBuildFile
    build_file_data, PHASE_EARLY, variables, build_file_path)
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 1295, in ProcessVariablesAndConditionsInDict
    build_file)
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 1310, in ProcessVariablesAndConditionsInList
    ProcessVariablesAndConditionsInDict(item, phase, variables, build_file)
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 1269, in ProcessVariablesAndConditionsInDict
    ProcessConditionsInDict(the_dict, phase, variables, build_file)
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 1142, in ProcessConditionsInDict
    build_file)
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 1066, in EvalCondition
    cond_expr, true_dict, false_dict, phase, variables, build_file)
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 1100, in EvalSingleCondition
    raise syntax_error
SyntaxError: invalid syntax while evaluating condition '${BUILD_LIBRDKAFKA:-1}==1' in binding.gyp at character 1. gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:336:16)
gyp ERR! stack     at emitTwo (events.js:125:13)
gyp ERR! stack     at ChildProcess.emit (events.js:213:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\LAB\MaisVendidoPorHora\src\obter-mais-vendido-por-hora\node_modules\node-rdkafka
gyp ERR! node -v v8.6.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN [email protected] No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

node-rdkafka does not work on Windows right now. If you want to try windows you can try cloning from the windows branch.

I forgot to say, I'm on Ubuntu 17.04

New build has been pushed to master with drastic differences in the way it is configured to hopefully bring this in better line with librdkafka. Can you try pulling from master to see if it works? I am going to publish it under 2.1.1 in a moment.

I tried and still have the sale problem, I also tried to install it in an empty folder, no result

@Vashnak we don't currently support node 8.x. Can you please add steps to reproduce for node 6.x and attach npm's log.txt from 6.x?

@mattness is there a plan to add node 8.x support in the future?

The error I am getting is:

ld: library not found for -lcrypto
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Release/node-librdkafka.node] Error 1

Config:

checking for OS or distribution... ok (osx)
checking for C compiler from CC env... failed
checking for gcc (by command)... ok
checking for C++ compiler from CXX env... failed
checking for C++ compiler (g++)... ok
checking executable ld... ok
checking executable nm... ok
checking executable objdump... ok
checking executable strip... ok
checking for debug symbols compiler flag (-g...)... ok
checking for pkgconfig (by command)... failed
checking for install (by command)... failed
checking for PIC (by compile)... ok
checking for GNU-compatible linker options... failed
checking for OSX linker options... ok
checking for GNU linker-script ld flag... failed
checking for Solaris linker-script ld flag... failed (ignore)
checking for __atomic_32 (by compile)... ok
checking for __atomic_64 (by compile)... ok
checking for socket (by compile)... ok
parsing version '0x000b01ff'... ok (0.11.1)
checking for libpthread (by compile)... ok
checking for zlib (by compile)... ok
checking for libcrypto (by compile)... failed (disable)
checking for liblz4 (by compile)... failed (disable)
checking for libssl (by compile)... failed (disable)
checking for libsasl2 (by compile)... ok
checking for crc32chw (by compile)... ok
checking for regex (by compile)... ok
checking for librt (by compile)... failed
checking for strndup (by compile)... ok
checking for strerror_r (by compile)... ok
checking for libdl (by compile)... ok
checking for nm (by env NM)... ok (cached)
Generated Makefile.config
Generated config.h

@teckays you need a cripto library, on CentOS you can do yum install -y openssl-devel etc. (other os's you will have to dig for)

i just had this issue and this fixed it no probs with v8 as of yet

@RosieCode95 I am using Debian for my Docker image and I do have the libsasl2-dev installed. I tried installing it locally on macOS Sierra as well, same result. node-rdkafka:2.0.0 installed successfully on my Mac with the previous NodeJS version (which was 7.x I think) but now I've upgraded Node to v8.7.0 and it fails.

yeh prob just have to find the right lib for you, im on 8,7.0 with a clean install of CentOS.7 with no issues.

@RosieCode95 just managed to install it on Debian by installing libssl-dev instead of libsasl2-dev. Still digging to make it work on macOS.

๐Ÿ‘Œ

For everyone else having problems installing [email protected] on macOS Sierra:

Error:

ld: library not found for -lcrypto
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Release/node-librdkafka.node] Error 1

Fix:

โ‡’  brew install openssl
โ‡’  echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.zshrc
โ‡’  echo 'export LDFLAGS="-L/usr/local/opt/openssl/lib"' >> ~/.zshrc
โ‡’  echo 'export CPPFLAGS="-I/usr/local/opt/openssl/include"' >> ~/.zshrc
-  reload terminal
โ‡’  npm i node-rdkafka

NOTE:
I am using Z shell. Make sure you replace ~/.zshrc with whatever shell you're using

@localzjaz I'm not sure about the error you have but from my own experience, installing node-rdkafka on Alpine is a nightmare. I was in the exact same situation when I decided to switch to Debian Jessie.

Let me know if you want me to share my Dockerfile
Hope this helps!

There are at least four different issues being presented here. The OP had this error:

Error: EEXIST: file already exists, mkdir './-dnode_gyp_module_name=librdkafka'

Someone else had trouble installing on Windows:
https://github.com/Blizzard/node-rdkafka/issues/267#issuecomment-337680140

Windows is not supported

Someone else had trouble finding the crypto library and was able to resolve it by adding CFLAGS: https://github.com/Blizzard/node-rdkafka/issues/267#issuecomment-338391501

finally, someone had trouble installing in Docker on Alpine.

These are all separate issues and reporting them in the same thread is not helping.

Please open separate issues, that way we can all keep debugging instructions distinct.

I am using a windows OS, and followed the instructions at https://github.com/Blizzard/node-rdkafka#windows and still the issue with node-gyp rebuild persists. Can anyone help me resolving this issue. Please find the attached debug log.

npm-debug.log

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

meierval picture meierval  ยท  4Comments

corybill picture corybill  ยท  6Comments

ivomirra picture ivomirra  ยท  3Comments

bigclap picture bigclap  ยท  5Comments

jacob-bennett picture jacob-bennett  ยท  4Comments