3

I've set up my code so that my main module consists of only the following:

var main = require('main2');

main();

This works in simulation's survival training mode, where main is a function. However, in the online survival mode I have started getting the following error:

main:3
main();
^
TypeError: object is not a function
    at main:3:1
    at process.emit (events.js:110:17)

Why have I started getting this error in the online survival mode?

2 Answers 2

3

This has been just fixed. Now require should work correctly at server-side.

1

I would expect that to invoke the function main in main2, you would use main.main(). var main is an object which contains the function main.

As to why it works in one context rather than the other, no idea. Perhaps you should ensure that the require is not actually returning empty/NULL/FILE NOT NOT FOUND. (should it be "./main2.js" etc.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .