pulsar-client-node: npm install fails on MacOS
System Information
- Operating System: MacOS Catalina 10.15.2
- Node version: 12.13.1
- node-gyp version: 6.1.0
- C++ Client: 2.5.0 (brew install libpulsar)
Running npm install pulsar-client
results in the following error:
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://pulsar.apache.org/docs/en/client-libraries-cpp/libpulsar-v1.1.0-node-v72-darwin-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for pulsar-client@1.1.0 and node@12.13.1 (node-v72 ABI, unknown) (falling back to source compile with node-gyp)
CC(target) Release/obj.target/nothing/../node-addon-api/src/nothing.o
LIBTOOL-STATIC Release/nothing.a
CXX(target) Release/obj.target/Pulsar/src/addon.o
In file included from ../src/addon.cc:20:
../src/Message.h:24:10: fatal error: 'pulsar/c/message.h' file not found
#include <pulsar/c/message.h>
^~~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [Release/obj.target/Pulsar/src/addon.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/richturnbull/.nvm/versions/node/v12.13.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:210:5)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 19.2.0
gyp ERR! command "/Users/richturnbull/.nvm/versions/node/v12.13.1/bin/node" "/Users/richturnbull/.nvm/versions/node/v12.13.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/richturnbull/dev/es/pulsar/client/node_modules/pulsar-client/build/Release/libpulsar.node" "--module_name=libpulsar" "--module_path=/Users/richturnbull/dev/es/pulsar/client/node_modules/pulsar-client/build/Release" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
gyp ERR! cwd /Users/richturnbull/dev/es/pulsar/client/node_modules/pulsar-client
gyp ERR! node -v v12.13.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/Users/richturnbull/.nvm/versions/node/v12.13.1/bin/node /Users/richturnbull/.nvm/versions/node/v12.13.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/richturnbull/dev/es/pulsar/client/node_modules/pulsar-client/build/Release/libpulsar.node --module_name=libpulsar --module_path=/Users/richturnbull/dev/es/pulsar/client/node_modules/pulsar-client/build/Release --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/Users/richturnbull/dev/es/pulsar/client/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:210:5)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1021:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
node-pre-gyp ERR! System Darwin 19.2.0
node-pre-gyp ERR! command "/Users/richturnbull/.nvm/versions/node/v12.13.1/bin/node" "/Users/richturnbull/dev/es/pulsar/client/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/richturnbull/dev/es/pulsar/client/node_modules/pulsar-client
node-pre-gyp ERR! node -v v12.13.1
node-pre-gyp ERR! node-pre-gyp -v v0.12.0
node-pre-gyp ERR! not ok
Failed to execute '/Users/richturnbull/.nvm/versions/node/v12.13.1/bin/node /Users/richturnbull/.nvm/versions/node/v12.13.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/richturnbull/dev/es/pulsar/client/node_modules/pulsar-client/build/Release/libpulsar.node --module_name=libpulsar --module_path=/Users/richturnbull/dev/es/pulsar/client/node_modules/pulsar-client/build/Release --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
npm WARN client@1.0.0 No description
npm WARN client@1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! pulsar-client@1.1.0 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the pulsar-client@1.1.0 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! /Users/richturnbull/.npm/_logs/2020-04-17T11_38_18_780Z-debug.log
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 6
- Comments: 31 (6 by maintainers)
Same here. I installed the cpp client first, but still same problem?
Thanks, it works for me
@nearzxide10
It seems clang doesn’t link to the
libpulsar
library yet. Temporally, you setLIBRARY_PATH
environment variable to thelibpulsar
path like below.I think the root cause of this issue is below. I’ll try to fix it. https://github.com/apache/pulsar-client-node/blob/d8d24eb5f563869ba0028b8a1ae8646601252a93/binding.gyp#L105-L108
don’t forget to do this step…
when I forget to run the step 2, I got the same issue…
this fixed me:
My thought is that npm install should add everything I need… Once I figure out how to get this installed, I have to help other developers get it going. Nope im out.
brew install libpulsar
and thennpm install pulsar-client
worked without any issues on macOS CatalinaIt seems to be because libpulsar does not yet support the m1 architecture
seems to be very sensitive to npm version, updating npm to latest version fixed issues.
this is sort of black magic to me 😦
Uhm, I was able to install using node 12.16.2 but not 8 nor 10
brew install libpulsar didn’t worked for me, I’m getting the following error