Reputation: 33144
Using https://github.com/couchbase/couchnode @v.1.2.4
Attempting to connect to CouchBase server using the code in the README
var couchbase = require('couchbase');
var cluster = new couchbase.Cluster();
var db = cluster.openBucket('default');
db.set('testdoc', {name:'Frank'}, function(err, result) {
if (err) throw err;
db.get('testdoc', function(err, result) {
if (err) throw err;
console.log(result.value);
// {name: Frank}
});
});
but am getting the following error:
db.js:2
var cluster = new couchbase.Cluster();
^
TypeError: undefined is not a function
at Object.<anonymous> (/Users/n/code/time/test/db.js:2:15)
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 Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
npr:time n$
Additional details:
Note: We tried searching on the CouchBase Bug Tracker: http://www.couchbase.com/issues/issues/?jql=text%20~%20%22typeError%22 in case other people were having the same error. No luck.
Upvotes: 2
Views: 2013
Reputation: 33144
The "solution" was to use the "Developer Preview" of Couchbase
npm install [email protected]
Then all the examples on https://github.com/couchbase/couchnode worked as expected.
See: http://blog.couchbase.com/nodejs-sdk-200-developer-preview
Upvotes: 4