Skip to content

Instantly share code, notes, and snippets.

@mediaupstream
Created August 15, 2012 22:31
Show Gist options
  • Save mediaupstream/3364308 to your computer and use it in GitHub Desktop.
Save mediaupstream/3364308 to your computer and use it in GitHub Desktop.
Recursive require crashes node
require('./index.js')();
module.exports = function(){
console.log('foo.js', Date.now() );
}
$ node --version
v0.6.2
$ node index.js
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: object is not a function
at Object.CALL_NON_FUNCTION (native)
at Object.<anonymous> (/fun/test/foo.js:1:83)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Module.require (module.js:357:17)
at require (module.js:368:17)
at Object.<anonymous> (/fun/test/index.js:1:63)
at Module._compile (module.js:432:26)
require('./foo.js')();
module.exports = function(){
console.log('index.js', Date.now());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment