n1ql query causes error node.js


I am writing a rest application to use on top of couchbase4
i am trying to use n1ql but even running the example i am getting a not good error that seems to kill the application

in my console i see the node.js app spit out:
testn1ql id:0 exited with code SIGSEGV

Here is the code, its basically taken from one of the n1ql samples:

var couchbase = require(‘couchbase’);

var myCluster = new couchbase.Cluster(‘couchbase://’);

var N1qlQuery = require(‘couchbase’).N1qlQuery;
var myBucket = myCluster.openBucket();
var query = N1qlQuery.fromString(‘SELECT * FROM default’);
myBucket.query(query, function(err, res) {
if (err) {
console.log(“query failed”, err);
console.log(“success!”, res);


Hey @jysf,

If you’re using Couchbase 4.0 and the latest Node.js SDK, you don’t need to use the following line:


Also try dropping couchbase:// from the new couchbase.Cluster function.

If you’re interested in a full working tutorial, I did a blog post here:


Let me know if this helps resolve your issue.



Yes, thank you very much!!!

And your blog post is very helpful! i wish i found that before :smile:

Sorry if this is an additional unrelated question:
Is there a good blog post or document that describes setting up couchbase in a development environment?
I am running it on a VirtualBox ubuntu 14, but it is not always very happy

Thanks again !


Hey @jysf,

If you’re just using a single node, I personally just install it on my local machine because Couchbase is very lightweight. If you’re looking for non-local or multi-node solutions, there are AWS images available for quick deployment.

Reach out if you need anything else :slight_smile: