NodeJS SDK installation

I am working on a project that uses NodeJS SDK. Today I encounter a problem while running yarn add couchbase after I updated my system. This is the error I am getting:

yarn add v1.22.17
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
error /home/mohammadreza/project/server/couchbase/node_modules/couchbase: Command failed.
Exit code: 1
Command: prebuild-install || node-gyp rebuild
Arguments: 
Directory: /home/project/server/couchbase/node_modules/couchbase
Output:
prebuild-install WARN install No prebuilt binaries found (target=17.1.0 runtime=node arch=x64 libc= platform=linux)
gyp info it worked if it ends with ok
gyp info using node-gyp@8.3.0
gyp info using node@17.1.0 | linux | x64
gyp info find Python using Python version 3.9.7 found at "/usr/bin/python3"
gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args   '/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/home/mohammadreza/project/server/couchbase/node_modules/couchbase/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/mohammadreza/.cache/node-gyp/17.1.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/mohammadreza/.cache/node-gyp/17.1.0',
gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/mohammadreza/.cache/node-gyp/17.1.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/home/mohammadreza/project/server/couchbase/node_modules/couchbase',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/home/mohammadreza/ULB/MA1/INFOH415 - Advanced Databases/project/server/couchbase/node_modules/couchbase/build'
  COPY ../deps/lcb/include/libcouchbase/libuv_io_opts.h
  COPY ../deps/lcb/include/libcouchbase/plugins/io/libuv/plugin-libuv.c
  COPY ../deps/lcb/include/libcouchbase/plugins/io/libuv/plugin-internal.h
  COPY ../deps/lcb/include/libcouchbase/plugins/io/libuv/libuv_compat.h
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/analytics/analytics_handle.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/analytics/analytics.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/bucketconfig/bc_cccp.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/bucketconfig/bc_file.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/bucketconfig/bc_http.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/bucketconfig/bc_static.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/bucketconfig/confmon.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/capi/cmd_analytics.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/capi/cmd_query.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/capi/cmd_search.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/capi/cmd_view.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/docreq/docreq.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/http/http.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/http/http_io.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/jsparse/parser.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/lcbht/lcbht.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/lcbio/connect.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/lcbio/ctx.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/lcbio/iotable.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/lcbio/ioutils.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/lcbio/manager.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/lcbio/protoctx.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/lcbio/timer.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/metrics/caching_meter.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/metrics/logging_meter.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/metrics/metrics-internal.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/metrics/metrics.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/mc/compress.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/mc/forward.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/mc/mcreq.o
In file included from ../deps/lcb/src/lcbio/manager.h:23,
                 from ../deps/lcb/src/lcbio/lcbio.h:21,
                 from ../deps/lcb/src/internal.h:43,
                 from ../deps/lcb/src/mc/mcreq.c:21:
../deps/lcb/src/lcbio/ioutils.h:74:54: warning: ‘struct addrinfo’ declared inside parameter list will not be visible outside of this definition or declaration
   74 | lcb_socket_t lcbio_E_ai2sock(lcbio_pTABLE io, struct addrinfo **ai, int *connerr);
      |                                                      ^~~~~~~~
../deps/lcb/src/lcbio/ioutils.h:76:57: warning: ‘struct addrinfo’ declared inside parameter list will not be visible outside of this definition or declaration
   76 | lcb_sockdata_t *lcbio_C_ai2sock(lcbio_pTABLE io, struct addrinfo **ai, int *conerr);
      |                                                         ^~~~~~~~
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/mcserver/mcserver.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/mcserver/negotiate.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/n1ql/ixmgmt.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/n1ql/n1ql-internal.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/n1ql/n1ql.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/n1ql/query_handle.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/n1ql/query_utils.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/netbuf/netbuf.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/operations/cbflush.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/operations/counter.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/operations/durability-seqno.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/operations/durability.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/operations/exists.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/operations/get_replica.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/operations/get.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/operations/observe-seqno.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/operations/observe.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/operations/pktfwd.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/operations/ping.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/operations/remove.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/operations/stats.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/operations/store.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/operations/subdoc.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/operations/touch.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/operations/unlock.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/rdb/bigalloc.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/rdb/chunkalloc.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/rdb/libcalloc.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/rdb/rope.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/search/search_handle.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/search/search.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/strcodecs/base64.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/tracing/span.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/tracing/threshold_logging_tracer.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/tracing/tracer.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/vbucket/ketama.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/vbucket/vbucket.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/views/view_handle.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/views/view.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/auth.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/bootstrap.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/callbacks.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/cntl.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/collections.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/connspec.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/crypto.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/defer.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/dns-srv.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/dump.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/errmap.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/getconfig.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/gethrtime.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/handler.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/hdr_timings.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/hostlist.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/instance.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/iofactory.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/list.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/logging.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/newconfig.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/nodeinfo.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/iometrics.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/retrychk.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/retryq.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/ringbuffer.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/rnd.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/settings.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/utilities.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/wait.o
  CC(target) Release/obj.target/couchbase/deps/lcb/plugins/io/select/plugin-select.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/ssl/ssl_c.o
In file included from ../deps/lcb/src/lcbio/manager.h:23,
                 from ../deps/lcb/src/lcbio/lcbio.h:21,
                 from ../deps/lcb/src/ssl/ssl_iot_common.h:21,
                 from ../deps/lcb/src/ssl/ssl_c.c:18:
../deps/lcb/src/lcbio/ioutils.h:74:54: warning: ‘struct addrinfo’ declared inside parameter list will not be visible outside
 of this definition or declaration
   74 | lcb_socket_t lcbio_E_ai2sock(lcbio_pTABLE io, struct addrinfo **ai, int *connerr);
      |                                                      ^~~~~~~~
../deps/lcb/src/lcbio/ioutils.h:76:57: warning: ‘struct addrinfo’ declared inside parameter list will not be visible outside of this definition or declaration
   76 | lcb_sockdata_t *lcbio_C_ai2sock(lcbio_pTABLE io, struct addrinfo **ai, int *conerr);
      |                                                         ^~~~~~~~
In file included from /home/mohammadreza/.cache/node-gyp/17.1.0/include/node/openssl/././archs/linux-x86_64/asm/include/openssl/ssl.h:21,
                 from /home/mohammadreza/.cache/node-gyp/17.1.0/include/node/openssl/./ssl_asm.h:11,
                 from /home/mohammadreza/.cache/node-gyp/17.1.0/include/node/openssl/ssl.h:4,
                 from ../deps/lcb/src/ssl/ssl_iot_common.h:26,
                 from ../deps/lcb/src/ssl/ssl_c.c:18:
/home/mohammadreza/.cache/node-gyp/17.1.0/include/node/openssl/macros.h:155:4: error: #error "OPENSSL_API_COMPAT expresses an impossible API compatibility level"
  155 | #  error "OPENSSL_API_COMPAT expresses an impossible API compatibility level"
      |    ^~~~~
make: *** [deps/lcb/couchbase.target.mk:273: Release/obj.target/couchbase/deps/lcb/src/ssl/ssl_c.o] Error 1
make: Leaving directory '/home/mohammadreza/ULB/MA1/INFOH415 - Advanced Databases/project/server/couchbase/node_modules/couchbase/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Linux 5.15.5-arch1-1
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/mohammadreza/project/server/couchbase/node_modules/couchbase
gyp ERR! node -v v17.1.0
gyp ERR! node-gyp -v v8.3.0
gyp ERR! not ok

I am on ArchLinux and I did not have this problem before while I was working with NodeJS SDK. I use docker for my couchbase setup. I have already tried removing node_modules file and installing all dependencies from 0 but that did not solve my issus. I also reinstalled node-gyp but that did not do anything.

Any resolution to this? I just ran into it as well on AWS Linux.

Can you try an LTS version of Node, such as 16.3.1 which the docs say are the versions supported by the SDK:
https://docs.couchbase.com/nodejs-sdk/current/hello-world/start-using-sdk.html#installing-the-sdk

The 17.0.2 version of Node isn’t currently an LTS release and my guess is this is an issue with the version of OpenSSL 17.x uses.

Thanks

Thank you for the prompt response. The net is what you expected.
In a fresh AWS Linux run
nvm install v16.13.1
→ v16.13.1

Run
npm install couchbase

Fails with
npm ERR! make: g++: Command not found

Run
sudo yum install gcc-c++

Run
npm install couchbase

Installation works!

Running
require(‘couchbase’);
console.log(‘ok’);

Shows ‘ok’.


FWIW, running
nvm install node

Succeeds
Running
node --version

shows
v17.2.0

Running
require(‘couchbase’);
console.log(‘ok’);

Error: Module did not self-register:
‘/home/ec2-user/node_modules/couchbase/build/Release/couchbase_impl.node’.

1 Like