apache / pulsar-client-node

Apache Pulsar NodeJS Client
https://pulsar.apache.org/
Apache License 2.0
148 stars 85 forks source link

Cannot build the nodejs client following the Readme #237

Open RobertIndie opened 2 years ago

RobertIndie commented 2 years ago

System: Ubuntu-18.04

When I followed the readme to build the client, it threw following errors at the npm run build step:

make: Entering directory '/workspaces/pulsar-client-node/build'
  SOLINK_MODULE(target) Release/obj.target/Pulsar.node
g++: error: ../pkg/lib/libpulsarwithdeps.a: No such file or directory
make: *** [Pulsar.target.mk:157: Release/obj.target/Pulsar.node] Error 1
make: Leaving directory '/workspaces/pulsar-client-node/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/opt/nodejs/17.6.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Linux 5.4.0-1090-azure
gyp ERR! command "/opt/nodejs/17.6.0/bin/node" "/opt/nodejs/17.6.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--module=/workspaces/pulsar-client-node/lib/binding/Pulsar.node" "--module_name=Pulsar" "--module_path=/workspaces/pulsar-client-node/lib/binding" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v102"
gyp ERR! cwd /workspaces/pulsar-client-node
gyp ERR! node -v v17.6.0
gyp ERR! node-gyp -v v8.4.1
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/opt/nodejs/17.6.0/bin/node /opt/nodejs/17.6.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --module=/workspaces/pulsar-client-node/lib/binding/Pulsar.node --module_name=Pulsar --module_path=/workspaces/pulsar-client-node/lib/binding --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v102' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/workspaces/pulsar-client-node/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1090:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
node-pre-gyp ERR! System Linux 5.4.0-1090-azure
node-pre-gyp ERR! command "/opt/nodejs/17.6.0/bin/node" "/workspaces/pulsar-client-node/node_modules/.bin/node-pre-gyp" "build"
node-pre-gyp ERR! cwd /workspaces/pulsar-client-node
node-pre-gyp ERR! node -v v17.6.0
node-pre-gyp ERR! node-pre-gyp -v v1.0.9
node-pre-gyp ERR! not ok 

Cannot find the libpulsarwithdeps.a. I found that there is a script to build the libpulsarwithdeps.a on the macos system but not for the linux system. I think we may need to update the Readme.

/cc @shibd

shibd commented 2 years ago

For Mac: You need first execute pkg/mac/build-cpp-deps-lib.sh and pkg/mac/build-cpp-lib.sh. For Linux: You need first execute build-support/install-cpp-client.sh.

I'll update the README later.

shibd commented 2 years ago

Update README: https://github.com/apache/pulsar-client-node/pull/239