Friday 28 April 2017

error 'require is not a function' when exported and required correctly

I am not exactly a node newbie, but this issue has me stumped. Basically, this is an issue for me, nobody else on my team. After the usual npm install etc, calling a function returns require(...) is not a function. I have exported it properly and am passing in the parameter properly and again, this seems to be limited to me. Any suggestions?

Function file

const logger = require('../util/logger')('someParam');
                                       ^Fails here

Logger file:

function logger(param) {
  console.log('this is the param: ', param);
}

module.export = logger;

I have tried this in node 4.4.2, 6.10.2 and 7.7.1



via jmcgui05

No comments:

Post a Comment