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. :(
What file should be built, libcouchbase.so? Where should it live?
Thx Brett
:)

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 

1 Answer

« Back to question.

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 :)

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

HTH

Andy

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. :)

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