Problem Node.js couchbase sdk

I am having problems running Node.js couchbase. I have
built libcouchbase C library but for reason it can find it.

/home/paul/workspaces/hoop/workspace/Bozo/node_modules/couchbase/lib/binding.js:37
throw new Error(‘Failed to locate couchnode native binding’);

I am use ubuntu 13.10…

thanks,
paul

Hi,
I have the same problem on CenOS 6.5.
/opt/piiLearningServer/node_modules/couchbase/lib/binding.js:37
throw new Error(‘Failed to locate couchnode native binding’);
^
Error: Failed to locate couchnode native binding
at Object. (/opt/piiLearningServer/node_modules/couchbase/lib/binding.js:37:9)
at Module._compile (module.js:456:26)
at Object.Module._extensions…js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/opt/piiLearningServer/node_modules/couchbase/lib/connection.js:6:15)
at Module._compile (module.js:456:26)
at Object.Module._extensions…js (module.js:474:10)
error: Forever detected script exited with code: 8

I am seeing the same thing on Linux Mint 16. npm install seems to work properly, and seems to build the lib, but then the same error in binding.js.

Same thing happens when I try the example.js in the node_modules/couchbase directory

Remove and re-install using npm does not help

Works fine on Windows

Help!

Hey Guys,

Do you have the your system build tools installed? This is a prerequisite of installing any native Node.js extension. Check this link for what you need to have available: https://github.com/TooTallNate/node-gyp.

Cheers, Brett

Yep, I retried with node-gyp re-installed, just to be sure. There are no error messages during the build, but same “Failed to locate couchnode native binding” upon running something to use it. :frowning:
What file should be built, libcouchbase.so? Where should it live?
Thx Brett
:slight_smile:

Would you mind checking the builderror.log file thats generated in the couchnode folder?
Cheers, Brett

AHA! Will try installing g++ …

make: g++: Command not found
make: *** [Release/obj.target/couchbase_impl/src/couchbase_impl.o] Error 127
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/share/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Linux 3.11.0-12-generic
gyp ERR! command “nodejs” “/usr/bin/node-gyp” "rebuild"
gyp ERR! cwd /home/aprice/node_modules/couchbase
gyp ERR! node -v v0.10.15
gyp ERR! node-gyp -v v0.10.9
gyp ERR! not ok

The command:
npm install couchbase
requires node-gyp and also g++ (and maybe others). However, the install fails quietly if g++ is not installed.
You may discover this by inspecting the builderror.log …
~/node_modules/couchbase $ cat builderror.log
make: g++: Command not found
make: *** [Release/obj.target/couchbase_impl/src/couchbase_impl.o] Error 127
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/share/node-gyp/lib/build.js:267:23)
etc.

Fix by issuing:
sudo apt-get install g++
npm install couchbase

Many thanks to Brett for leading me to the solution :slight_smile:

Brett: can the install be made to fail loudly if prerequisits are not present?

HTH

Andy

1 Like

Hey aprice,
Keep in mind that g++ is a requirement of node-gyp (which I mentioned above). Unfortunately, npm does not currently have any method of defining ‘maybe build this’ kinds of resources (like the C++ binding for couchnode). This means we have to manually invoke node-gyp and ignore its errors in order to properly support platforms where prebuilt binaries are available. In hindsight, what I will do however, is add a reference to the builderror.log in the ‘Failed to load native binding’ error!
Cheers, Brett

Yes, a neat solution. Well thought, and thanks again. :slight_smile:

Fixed: http://review.couchbase.org/#/c/36537/ Should show up in the next release :slight_smile:

Hello, i am getting a similar error. Can you please help me,

SyntaxError: invalid syntax
gyp ERR! configure error
gyp ERR! stack Error: gyp failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:343:16)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:809:12)
gyp ERR! System Linux 2.6.32-504.1.3.el6.x86_64
gyp ERR! command “node” “/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js” "rebuild"
gyp ERR! cwd /usr/src/site/node_modules/couchbase
gyp ERR! node -v v0.10.29
gyp ERR! node-gyp -v v0.13.1
gyp ERR! not ok

Hello!

Actually, getting same problem with starting after successful build. g++ installed and builderror.log contains this information:

In file included from ../deps/lcb/src/bucketconfig/bc_http.c:21:0: ../deps/lcb/src/bucketconfig/bc_http.c: In function ‘on_connected’: ../deps/lcb/src/lcbio/ssl.h:150:48: warning: statement with no effect [-Wunused-value] #define lcbio_sslify_if_needed(sock, settings) LCB_SUCCESS ^ ../deps/lcb/src/bucketconfig/bc_http.c:348:5: note: in expansion of macro ‘lcbio_sslify_if_needed’ lcbio_sslify_if_needed(sock, http->base.parent->settings); ^ In file included from ../deps/lcb/src/http/http_io.c:22:0: ../deps/lcb/src/http/http_io.c: In function ‘on_connected’: ../deps/lcb/src/lcbio/ssl.h:150:48: warning: statement with no effect [-Wunused-value] #define lcbio_sslify_if_needed(sock, settings) LCB_SUCCESS ^ ../deps/lcb/src/http/http_io.c:209:5: note: in expansion of macro ‘lcbio_sslify_if_needed’ lcbio_sslify_if_needed(sock, settings); ^ In file included from ../deps/lcb/src/instance.c:24:0: ../deps/lcb/src/instance.c: In function ‘setup_ssl’: ../deps/lcb/src/lcbio/ssl.h:149:33: warning: statement with no effect [-Wunused-value] #define lcbio_ssl_global_init() 0 ^ ../deps/lcb/src/instance.c:215:9: note: in expansion of macro ‘lcbio_ssl_global_init’ lcbio_ssl_global_init();

I was running this on a Windows box and my python version was 3.4.3. The node_modules/couchbase/builderror.log clearly said that it expected python version >2.5 and <3.0.
Uninstalled the python 3.4.x that I had and installed 2.7.9. This fixed the problem for me

Hi @brett19

Can you help with this error? I don’t get install couchbase package.

npm-debug.log.zip (73.2 KB)

My Package.json:

{
“name”: “swarm”,
“version”: “1.0.0”,
“description”: “swarm demo”,
“main”: “app.js”,
“author”: “jarvis”,
“license”: “MIT”,
“dependencies”: {
“body-parser”: “^1.17.1”,
“couchbase”: “^2.3.2”,
“express”: “^4.15.2”
}
}

Node version: 6.10.2

I ran node-gyp rebuild inside node_modules/couchbase and it worked. But, what would the explanation for that?