Node.js SDK 'undefined symbol' error from couchbase_impl.node

Hello,

I have successfully installed Couchbase Node.j SDK on linux. I got the following error when I tried to connect to a bucket.

$ node test.js
$/home/user1/node_modules/couchbase/build/Release/couchbase_impl.node: undefined symbol: _ZN4node12MakeCallbackEN2v86HandleIMS0_6ObjectEEENS1_INS0_8FunctionEEEiPNS1_INS0_5ValueEEE

Here is my test.js file:

var couchbase = require(‘couchbase’);
var db = new couchbase.Connection({host: ‘lcoalhost:8091’, bucket: ‘default’});

Any suggestions?

Thanks!

Did you install via npm, or did you download for github and build manually?

Thanks for your reply. I have fixed this error by reinstall the libcouchbase by apt-get install.

I’m having this exact same problem too, on Ubuntu 12.04, but reinstalling libcouchbase via apt-get with the repository has not helped. Can you let me know the specific version of libcouchbase and couchnode you’re using? Thanks.

Hello vantage,

I followed the following links, and install it on Ubuntu 12.04.
http://www.couchbase.com/docs/couchbase-sdk-c-2.0/c-install-linux-ubuntu.html

Unfortunately, I followed all the instructions there after completely uninstalling my libcouchbase again but I’m still getting the same error.

Vantage, couchnode is not being installed correctly, and the problem may have nothing to do with your libcouchbase installation. Try going into the node_modules/couchbase directory and running:

npm install

Do you get any errors or warnings during the node-gyp rebuild stage of the npm install procedure?

I’ve rebuilt the couchbase module several times, I get no errors or warnings. I just did another one, here’s what displayed during the node-gyp build stage:

> couchbase@1.0.1 install /pathhere/node_modules/couchbase > node-gyp rebuild

make: Entering directory /pathhere/node_modules/couchbase/build' CXX(target) Release/obj.target/couchbase_impl/src/couchbase_impl.o CXX(target) Release/obj.target/couchbase_impl/src/control.o CXX(target) Release/obj.target/couchbase_impl/src/constants.o CXX(target) Release/obj.target/couchbase_impl/src/namemap.o CXX(target) Release/obj.target/couchbase_impl/src/cookie.o CXX(target) Release/obj.target/couchbase_impl/src/commandbase.o CXX(target) Release/obj.target/couchbase_impl/src/commands.o CXX(target) Release/obj.target/couchbase_impl/src/exception.o CXX(target) Release/obj.target/couchbase_impl/src/options.o CXX(target) Release/obj.target/couchbase_impl/src/cas.o CC(target) Release/obj.target/couchbase_impl/src/uv-plugin-all.o CXX(target) Release/obj.target/couchbase_impl/src/valueformat.o SOLINK_MODULE(target) Release/obj.target/couchbase_impl.node SOLINK_MODULE(target) Release/obj.target/couchbase_impl.node: Finished COPY Release/couchbase_impl.node make: Leaving directory/pathhere/node_modules/couchbase/build’

The same problem still comes up. I was looking at the source code of libcouchbase, and I see what looks like the line where this symbol lookup error could be occurring:

node::MakeCallback(v8::Context::GetCurrent()->Global(), cb, 1, &excObj);

This is line 61 of couchbase/src/couchbase_impl.cc in the couchbase package. I’m not a C++ dev though, so it’s hard for me to determine what library is having a problem here.

Hmm… all that I can think to suggest is:

  1. Check that the correct version of libcouchbase is installed (should be 2.1.3).

    dpkg --list | grep “libcouchbase”

  2. Make sure that none of your old builds of libcouchbase are in your include paths.

    dpkg --purge libcouchbase-dev libcouchbase2-core

find / -name “libcouchbase*”

The only things that should show up in this search are the .deb files.

apt-get install libcouchbase2 libcouchbase-dev

Thanks, but still no luck. I found that there was a libcouchbase directory in /usr/local/include, as well as some libevent header files, and I deleted them all, purged and reinstalled the libcouchbase packages, and the same problem remains. I do have the 2.1.3 version of libcouchnode installed. I’ve also tried downloading couchnode from Git and running npm install inside it, and it produces the same error.

I am using Couchbase 2.0, could that have anything to do with it? Do I need to upgrade to 2.2?

I finally figured it out. I had originally installed the Node version 0.6 that’s in the main Ubuntu repository, then later I built 0.10 from source and installed it so I could use current modules. However, it looks like this did not place all the libraries necessary for couchnode to work. I wiped all my Node.js stuff off the system, then added the Ubuntu Node 0.10 repository and reinstalled it via apt-get and now it works. Thanks!