Question

I'm using a customized version of node-clim, but I want to put away all the customization code in a module of its own and require() it in my main app. But I can't seem to do that..

This code works

var util = require('util');
var clim = require('clim')
clim.logWrite = function(level, prefixes, msg) {
    ...
    customizing code
    ...
    process.stderr.write(...);
};

var console = clim();

console.log('hey'); // works

But in trying to put the above in a separate file clim.js and exporting the console object...

module.export = console;

and require()ing it in my main app doesn't work..

var console = require('./clim');
console.log('hey');
//      ^ TypeError: Object #<Object> has no method 'log'

What am I doing wrong?

Was it helpful?

Solution

Change

module.export = console;

to

module.exports = console;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top