Search code examples
c++node.jsubuntu-16.04apache-pulsar

Installing node js pulsar client on ubuntu


I am trying to install the pulsar-client for node js client on ubuntu. I get the following error:

fatal error: pulsar/c/message.h: No such file or directory  #include <pulsar/c/message.h>
compilation terminated.
Pulsar.target.mk:116: recipe for target 'Release/obj.target/Pulsar/src/addon.o' failed
make: *** [Release/obj.target/Pulsar/src/addon.o] Error 1

the documentation says

Pulsar Node.js client library is based on the C++ client library. Follow the instructions for C++ library for installing the binaries through RPM, Deb or Homebrew packages.

(Note: you will need to install not only the pulsar-client library but also the pulsar-client-dev library)

However, the instructions for installing C++ library on Ubuntu are not very clear. It is also not clear how to install pulsar-client-dev library.


Solution

  • You are right that C++ library must be installed. One note is please make sure the compatible C++ library is installed. https://github.com/apache/pulsar-client-node#compatibility

    To install C++ library ubuntu, here is an example which is from our Docker image build on Ubuntu based. https://github.com/kafkaesque-io/pulsar-beam/blob/master/Dockerfile#L29

    wget --user-agent=Mozilla -O apache-pulsar-client.deb "https://archive.apache.org/dist/pulsar/pulsar-2.4.1/DEB/apache-pulsar-client.deb"
    wget --user-agent=Mozilla -O apache-pulsar-client-dev.deb "https://archive.apache.org/dist/pulsar/pulsar-2.4.1/DEB/apache-pulsar-client-dev.deb"
    
    apt install -y ./apache-pulsar-client.deb
    apt install -y ./apache-pulsar-client-dev.deb