Yarn add couchbase error

I am trying to install couchbase with a command
yarn add couchbase
and I got error

[  5%] Building CXX object deps/couchbase-cxx-client/couchbase/tracing/CMakeFiles/couchbase_tracing.dir/threshold_logging_tracer.cxx.o
In file included from /app/node_modules/couchbase/deps/couchbase-cxx-client/third_party/asio/asio/include/asio/io_context.hpp:18,
                 from /app/node_modules/couchbase/deps/couchbase-cxx-client/couchbase/tracing/threshold_logging_tracer.hxx:23,
                 from /app/node_modules/couchbase/deps/couchbase-cxx-client/couchbase/tracing/threshold_logging_tracer.cxx:18:
/app/node_modules/couchbase/deps/couchbase-cxx-client/third_party/asio/asio/include/asio/detail/config.hpp:1468:11: fatal error: linux/version.h: No such file or directory
 1468 | # include <linux/version.h>
      |           ^~~~~~~~~~~~~~~~~
compilation terminated.

I have:

  • node version: 12.22.8
  • yarn version: 1.22.17

so, I need help with installation…

Hi @r.zaglinskij,

From searching on the internet, it seems like you are missing the linux-headers package on your linux distro.

You can try installing it

sudo apt-get install linux-headers-$(uname -r)

apk add musl-dev linux-headers - executed succesfully
yarn add couchbase - execution on a screenshot

Summarizing the discussion on Discord for future reference.

After installing the linux headers and the node-addon-api, the installation errors disappeared.

apk add musl-dev linux-headers
RUN yarn add node-addon-api
RUN yarn add couchbase

The issues were caused mainly due to the fact that alpine linux image is not supported on arm64 environment. Arm64 is supported on any glibc based os like ubuntu or centos.

so, is it possible for me to run project inside docker with node-couchbase on M1 ?

Hi @r.zaglinskij

If you want to use alpine, no. If you are able to use Ubuntu, that will work.

so, please confirm - I need to use ubuntu image for container? or pc with Ubuntu ?

You will be able to work with an ubuntu image.