Trouble getting started - Error: The couchbase module version used by the application does not match Ottomans

OS: Ubuntu 16.04
Couchbase version: Version: 4.5.1-2844 Enterprise Edition (build-2844)
Node version: v6.5.0 (not selectable in your list below)

Getting started for evaluation. I went through the install and setup without issue and have cloned try-cb. This is the result of ‘npm run start’:
(sosadmin) ~/wk/cliosoft/sosadmin/couchbase/try-cb $ npm run start

> try-cb@0.1.0 start /home/paul/wk/cliosoft/sosadmin/couchbase/try-cb
> node app.js

throw new Error('The couchbase module version used by the application'

Error: The couchbase module version used by the application does not match Ottomans. Please explicitly pass the application couchbase module using `StoreAdapter.Couchbase`.
at new CbStoreAdapter (/home/paul/wk/cliosoft/sosadmin/couchbase/try-cb/node_modules/ottoman/lib/cbstoreadapter.js:33:13)
at Ottoman.set (/home/paul/wk/cliosoft/sosadmin/couchbase/try-cb/node_modules/ottoman/lib/ottoman.js:55:20)
at Object.<anonymous> (/home/paul/wk/cliosoft/sosadmin/couchbase/try-cb/model/user.js:3:16)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/paul/wk/cliosoft/sosadmin/couchbase/try-cb/model/auth.js:4:12)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)

As I’m just getting started I’ve no idea how to carry out the suggested fix and google has not been any help. Can anyone point me in the right direction?


Because of the internal dependancy between Ottoman.js and the Node.js SDK, and a quirk of how JavaScript performs object comparison, you must ensure that your applications Node.js SDK version matches the one Ottoman is using (or explicitly provide the right SDK to ottoman). In the first case, simply check the package.json for the version of Ottoman.js you are using, and then use the same version in your application. In the second case, simply replace:

ottoman.bucket = myBucket;

with the following instead:

// assumes couchbase is `require('couchbase')`
// assumes myBucket is your couchbase.Bucket object. = new ottoman.CbStoreAdapter(myBucket, couchbase);

Cheers, Brett


Bear with me, all a bit new to node and ottoman/couchbase.

I get the same error when working through example apps. eg. the url shortener one - URL Shortener using Ottoman ODM with Node.js & Couchbase

After doing a fresh npm install of dependencies the package.json shows the following versions:

“dependencies”: {
“body-parser”: “^1.15.2”,
“couchbase”: “^2.3.0”,
“express”: “^4.14.0”,
“hashids”: “^1.1.1”,
“ottoman”: “^1.0.4”

The package.json file for ottoman in node_modules shows a dependency on couchbase of: "couchbase": "~2.2.2"

Setting the couchbase version in the apps package.json to the same and doing a npm install to update the dependencies… couchbase updates to 2.2.5 (2.2.2 not available?). Running the app I still get the same error.

Alternatively, to solve this in code how would I do this? The urlshortener example code has:

ottoman.bucket = (new couchbase.Cluster(“couchbase://localhost”)).openBucket(“example”);

What should I replace this with? I tried this:

cluster = new couchbase.Cluster(“couchbase://localhost”);
bucket = cluster.openBucket(“example”); = new ottoman.CbStoreAdapter(bucket, couchbase);

This got the code to run but only returned Cannot GET / when I hit the service. Given the rest of the code is as in the example I don’t think I’ve fixed it (just changed the symptom?)

Do you have some pointers?


Hey @kartaphilos,

You’re package.json version descriptor on your application should be "couchbase": "~2.2.5" to match the most current Ottoman.js version ( which should be `“ottoman”: “~1.0.4”). This should fix your versioning issue.

On your attempt for the other possible solution (specifying the couchbase package explicitly). You have done the correct instantiation, and the lack of any error messages from Ottoman indicates that it is working. It sounds like your application code may be at fault for the remaining issue. Cannot GET / indicates that there is no express route configured for your root. Can you post your application code to a Gist perhaps?

Cheers, Brett

1 Like

Hi Brett,

Thanks for the reply. I got the work-around method working… had a code issue (no really! ;-)) and the Windows 10 anniversery issue which was solved by going to 4.6. Fixing those two up and I have an api responding as expected. To improve my error handing in the future, is there a way to catch exceptions when opening connections to couchbase? ie. something like:

cluster = new couchbase.Cluster(“couchbase://localhost”, function(err) {
if (err) { console.log(“Can’t connect to couchbase: %s”, err) }
(and similarly for open bucket commands, etc)

btw - for completeness (and curiosity) I also tried to get the ottoman v couchbase versioning aligned but couldn’t solve this. Here’s what I tried…

The dependency in the ottoman (v1.0.4) package.json file lists a dependency (& optional dependency) on couchbase ~2.2.2. My first attempt at correcting this was to make my app have a dependency of ~2.2.2 in its package.json. When doing an npm install it installed the 2.2.5 version of couchbase. If I change the dependency in the app to ~2.2.5 as suggested it makes no difference. Is there a way to rebuild/make ottoman to use 2.2.5 rather 2.2.2? ie. can I update its package.json and rebuild that ‘module’?

Thanks for your help,

I modified the package.json of the travel app and changed

couchbase: “*”


couchbase: “~2.2.2”

as the Ottoman version 1.0.4 depends on couchbase version 2.2.2.
After cleaning the node_modules directory and running

npm install

I was able to get the travel sample app up and running.

Hi, @brett19

Can you help me with this error?
The couchbase module version used by the application does not match Ottomans. Please explicitly pass the application couchbase module usingStoreAdapter.Couchbase`.

I’m getting this error using the new version of Couchbase server 4.6 inside a Docker container.

My package.json:
"dependencies": { "body-parser": "^1.16.1", "couchbase": "^2.3.0", "express": "^4.14.1", "ottoman": "^1.0.4" }
My app.js:

var express = require(‘express’)
var couchbase = require(‘couchbase’)
var bodyParser = require(‘body-parser’)
var ottoman = require(‘ottoman’)

var app = express()

app.use(bodyParser.urlencoded( { extended: true } ))

var cluster = new couchbase.Cluster(‘couchbase://’)
var bucket = cluster.openBucket(‘atgb’)

module.exports.bucket = bucket

ottoman.bucket = bucket

var routes = require(’./route’)(app)

ottoman.ensureIndices( (err) => {
var server = app.listen(3000, () => {
console.log(‘Server listen on port 3000…’)

Hey @allysson.v1,

This is due to a version missmatch between the Node.js SDK version installed with Ottoman, and the version you have installed locally for your application. The most compatible workaround is to tell Ottoman which version of the SDK it should use.

You can do that by replacing:

ottoman.bucket = bucket;

With: = new ottoman.CbStoreAdapter(bucket, ottoman);

Cheers, Brett

Hi, @brett19

Unfortunately, the same error still persist.


I was running the code using node version 6.10.0. I switched to v5.0.0 and the error changed:

Module version mismatch. Expected 47, got 48.

Did you already faced that?

Hey @allysson.v1,

You need to reinstall the module to download the new binaries for the specific version of Node.js you are using.

Cheers, Brett

Hi @brett19,

I face same issue as @allysson.v1 and by using your solution is start to work but

in getById method from model i could not load referenced documents

my document is

"_type": “Customer”,
“billingAddress”: {
“postalCode”: “97203”,
“country”: {
"_type": “Country”,
"$ref": “US”
“state”: “OR”,
“line1”: “3942 NE Sixth St.”,
“city”: “Portland”
“username”: “aaha123”,
“updated”: “2015-07-24T15:59:26.000Z”,
“firstName”: “Anne”,
“created”: “2015-03-10T04:33:14.000Z”,
“lastName”: “Aha”,
“email”: ""

and i try to get it by

models.Customer.getById(username,{load: [“country”]},function(err, customer){
if (err) {
response.status(404).json({‘error’: err});
} else {




Hi @brett19,

I installed latest git version of ottoman using npm install git_url

and it start to work normally with ottoman.bucket()

but after trying getById this was the result:

“line1”:“3942 NE Sixth St.”,

using load option or no using it is not affecting the result.

i’m realy confused. :blush:


Its working well now i find out that when i print result to consul i can see one level deep of nested data in json,

country code is {“billingAddress”:{“postalCode”:“97203”,“country”:{"$ref":“Country”,"$id":“US”},“state”:“OR”,“line1”:“3942 NE Sixth St.”,“city”:“Portland”},“username”:“aaha123”,“updated”:“2015-07-24T15:59:26.000Z”,“firstName”:“Anne”,“created”:“2015-03-10T04:33:14.000Z”,“lastName”:“Aha”,“email”:“”}

and if i try to get json from the i’m able to print data belong to country

is there any way to get around it.