Saturday, 27 May 2017

couhbase configuration cluster undefined

Using couchbase database, I get this error in config/db.js:

var cluster = new _couchbase2.default.Cluster(_env2.default.database.cluster);
TypeError: Cannot read property 'cluster' of undefined

config/env/development.js:

const config = {
    database: {
        cluster: '...',
        password: '',
        bucket: '...'
    }
}

export default config;

config/env/index.js:

const env = process.env.NODE_ENV || 'development';
const config = require(`./${env}.js`);

export default config;

config/db.js:

import config from './env';

const cluster = new couchbase.Cluster(config.database.cluster);



via Alvin

No comments:

Post a Comment