Within Node.js such issue may occur *only* when your dealing with cyclic dependencies. If it's the case just move require's to modules in question to end of the file (after assignment to module.exports), it will fix that.
If it's none of the above, then either you misinterpreted something, or your modules are not loaded natively by Node but not in a compliant way by some other stuff in the middle, that could be the only explanation.
On Thursday, September 6, 2012 1:01:09 PM UTC+2, Andreas Richter wrote:
One of my modules was using:
module.exports = { loadModules: loadModules, initModules: initModules, eventRouteModules: eventRouteModules, notifyDependenciesOfInit: notifyDependenciesOfInit,
notifyDependenciesOfRoute: notifyDependenciesOfRoute, registerDependencies: registerDependencies, loadAbout: loadAbout };
instead of:
module.exports.loadModules = loadModules;
module.exports.initModules = initModules;
module.exports.eventRouteModules = eventRouteModules;
module.exports.notifyDependenciesOfInit = notifyDependenciesOfInit;
module.exports.notifyDependenciesOfRoute = notifyDependenciesOfRoute;
module.exports.registerDependencies = registerDependencies;
module.exports.loadAbout = loadAbout;
Seems harmless and worked pretty much 99% of the time. However when running mocha on TravisCI it would fail saying it couldn't find loadAbout.
I tried many different things and could not narrow it down to anything else but this change. The issue occurs both on node 0.6 and 0.8 based versions.
Locally I tested the same variations on Mac OS and ubuntu and they did not show the problem.
Does anyone have any ideas why this would cause problems on some platforms?