Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node_modules/node-rdkafka/build/Release/node-librdkafka.node: invalid ELF header #1023

Closed
fberrez opened this issue Jun 14, 2023 · 1 comment

Comments

@fberrez
Copy link

fberrez commented Jun 14, 2023

Environment Information

  • OS: debian (docker image node:18)
  • Node Version: 18.16.0
  • NPM Version: 8.19.3
  • C++ Toolchain: -
  • node-rdkafka: 2.16.1

Steps to Reproduce

In a project that uses node-rdkafka, I got this issue when I run it in a docker container:

test  |
test  | > [email protected] start
test  | > node index.js
test  |
test  | /usr/src/app/node_modules/bindings/bindings.js:121
test  |         throw e;
test  |         ^
test  |
test  | Error: /usr/src/app/node_modules/node-rdkafka/build/Release/node-librdkafka.node: invalid ELF header
test  |     at Module._extensions..node (node:internal/modules/cjs/loader:1338:18)
test  |     at Module.load (node:internal/modules/cjs/loader:1117:32)
test  |     at Module._load (node:internal/modules/cjs/loader:958:12)
test  |     at Module.require (node:internal/modules/cjs/loader:1141:19)
test  |     at require (node:internal/modules/cjs/helpers:110:18)
test  |     at bindings (/usr/src/app/node_modules/bindings/bindings.js:112:48)
test  |     at Object.<anonymous> (/usr/src/app/node_modules/node-rdkafka/librdkafka.js:10:32)
test  |     at Module._compile (node:internal/modules/cjs/loader:1254:14)
test  |     at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
test  |     at Module.load (node:internal/modules/cjs/loader:1117:32) {
test  |   code: 'ERR_DLOPEN_FAILED'
test  | }
test  |
test  | Node.js v18.16.0
test exited with code 1

So I tried to make a simpler project that only import node-rdkafka. Here is the files: https://github.com/fberrez/bug-node-rdkafka

When I run it locally, I have:

$ npm start

> [email protected] start
> node index.js

[
  'gzip',       'snappy',
  'sasl',       'regex',
  'lz4',        'sasl_gssapi',
  'sasl_plain', 'plugins',
  'http'
]

But it doesn't work in the container and the error I wrote above occurs.

@fberrez
Copy link
Author

fberrez commented Jun 15, 2023

Finally got the problem, I was installing modules on a macos while the image runs on linux.

@fberrez fberrez closed this as completed Jun 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant