Node-rdkafka: Npm install fails with latest node-rdkafka & node <= v10

Created on 16 Jun 2020  Â·  10Comments  Â·  Source: Blizzard/node-rdkafka

Using Node v10.0, I get the following error when running an npm install on a project with [email protected]:

make[2]: Leaving directory `/home/kit/dev/noderdkafkatest/node_modules/node-rdkafka/deps/librdkafka/examples'
Updating CONFIGURATION.md
CONFIGURATION.md CONFIGURATION.md.tmp differ: byte 418, line 6
Installing documentation to /home/kit/dev/noderdkafkatest/node_modules/node-rdkafka/build/deps
install -d $DESTDIR/home/kit/dev/noderdkafkatest/node_modules/node-rdkafka/build/deps/share/doc/librdkafka
install LICENSE LICENSES.txt INTRODUCTION.md README.md CONFIGURATION.md STATISTICS.md $DESTDIR/home/kit/dev/noderdkafkatest/node_modules/node-rdkafka/build/deps/share/doc/librdkafka
make[1]: Leaving directory `/home/kit/dev/noderdkafkatest/node_modules/node-rdkafka/deps/librdkafka'
  TOUCH Release/obj.target/deps/librdkafka.stamp
  CXX(target) Release/obj.target/node-librdkafka/src/binding.o
../src/binding.cc: In function ‘void Init(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’:
../src/binding.cc:81:28: error: ‘GetCurrentEnvironment’ is not a member of ‘node’
   node::Environment* env = node::GetCurrentEnvironment(context);
                            ^
make: *** [Release/obj.target/node-librdkafka/src/binding.o] Error 1
rm deps_librdkafka_gyp_librdkafka_target_build_dependencies.intermediate
make: Leaving directory `/home/kit/dev/noderdkafkatest/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 (/home/kit/.nvm/versions/node/v10.0.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:225:12)
gyp ERR! System Linux 3.10.0-1062.12.1.el7.x86_64
gyp ERR! command "/home/kit/.nvm/versions/node/v10.0.0/bin/node" "/home/kit/.nvm/versions/node/v10.0.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/kit/dev/noderdkafkatest/node_modules/node-rdkafka
gyp ERR! node -v v10.0.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

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.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/kit/.npm/_logs/2020-06-16T13_03_15_567Z-debug.log

The debug log didn't seem to contain any info on the error.

Environment Information

  • OS [e.g. Mac, Arch, Windows 10]: RHEL 7.7 (Maipo) amd64 (also seen on MacOS)
  • Node Version [e.g. 8.2.1]: v10.0 & v11.0
  • NPM Version [e.g. 5.4.2]: 6.4.1
  • C++ Toolchain [e.g. Visual Studio, llvm, g++]: g++
  • node-rdkafka version [e.g. 2.3.3]: 2.9.0

Steps to Reproduce

  1. Set node version to v10.0
  2. Create a simple node project with [email protected] as a dependency
  3. Run npm install. It fails with the above error.
  4. Set node version to v11.0
    5 Rerun npm install. It completes.

node-rdkafka Configuration Settings
Default.

Additional context
nvm was used to change the node versions
Also fails on node v.9.0

Most helpful comment

I published a new version (v2.9.1) that should fix this.

All 10 comments

I see this happening with Node 9 however LTS versions (including 10) are working fine.
docker run -ti --rm -w /test node:10 npm i node-rdkafka

@iradul Thx, yes I've just tried it on earlier LTSes. 4.91 & 8.17.0 both work fine.

Maybe this needs to be clarified in the docs?

I think we can easily fix this for Node 9.

Node 10, less then 10.16.0 also doesn't compile (#807).
I've tested 11.0.0 and 12.0.0, both looking good.

Hi @iradul I'm currently seeing this error with node 11.0.0

'GetCurrentEnvironment' is not a member of 'node'
   node::Environment* env = node::GetCurrentEnvironment(context);

docker run --rm -ti node:11.0 bash -c 'echo "Node version $(node -v)" && npm i node-rdkafka'

@iradul That works for me, thanks.

@iradul what is the latest version that is supported on Node 10, less than 10.16.0? I'm running node v10.13.0 LTS and can confirm I also got this issue.

@iradul what is the latest version that is supported on Node 10, less than 10.16.0? I'm running node v10.13.0 LTS and can confirm I also got this issue.

It seems like at node-rdkafka

  • v2.7.4 it worked
  • v2.8.0 it broke node 8, 9 & 10-10.15 installation:

    • 22452f8, Apr 5 2020, Support Node.js 13.x, #759

  • v2.9.0 it fixes node 8 install
  • v2.9.1 it fixes 9 - 10.15 (Jul 22, 2020)

    • 0a77510 fixes node 9 installation

    • 41e7333 fixes node 10-10.15 installation

I published a new version (v2.9.1) that should fix this.

Was this page helpful?
0 / 5 - 0 ratings