Cannot make couchbase node.js SDK working under CenOS 6.5

Cannot make couchbase node.js client working under CenOS 6.5.

Here is the error when I start my nodejs process:

/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

If I look into /opt/piiLearningServer/node_modules/couchbase/lib/binding.js, I see that it is trying to load ../prebuilt/win/x64/couchbase_impl ... is it not a window lib; should I get a nodejs.SDK for centos????

if (!couchnode) {
// Try to load prebuilt windows binaries
if (process.arch === 'x64') {
couchnode = tryLoadBinding('../prebuilt/win/x64/couchbase_impl');
} else if (process.arch === 'ia32') {
couchnode = tryLoadBinding('../prebuilt/win/ia32/couchbase_impl');
}
}

Linux emulator 2.6.32-431.11.2.el6.x86_64 #1 SMP Tue Mar 25 19:59:55 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux - CentOS release 6.5 (Final)

Running into same problem.

2 Answers

« Back to question.

Hi guys,
I had similar problem on Ubuntu. The problem is that couchbase_impl can't be compiled. To solve the problem, I've added "node-gyp": "~0.11.0" to the dependencies in package.json and then run "npm update". Then I've installed the gcc library - "sudo apt-get install build-essential g++" .Finally I had to rebuild the couchbase client.
cd path_to_nodejs_project/node_modules/coucbase/
node-gyp clean
node-gyp configure
node-gyp build

This solved my problem.
Cheers Kris

« Back to question.

I ran into same problem on Ubuntu. For me it was a twofold issue
1. node is renamed nodejs because of a conflict with a package I don't use. Added a soft link so /usr/bin/node now refers to nodejs. I don't think this is an issue in CentOS but maybe worth checking.

2. I rebuilt the native code in my express application directory by issuing: npm rebuild

Good luck