Can't require local CoffeeScript modules

Posted by superlukas on Stack Overflow See other posts from Stack Overflow or by superlukas
Published on 2013-10-31T21:11:51Z Indexed on 2013/10/31 21:54 UTC
Read the original article Hit count: 264

Filed under:
|

I'm running Node.js 0.10.21. I tried both CoffeeScript 1.6.3 and master both with and without require('coffee-script/extensions'). Compiling the two files to JavaScript and running them directly in Node works just fine of course.

# ./folder/a.coffee
require('../b').test()

# ./b.coffee
exports.test = -> console.log 'yay'

# $ coffee folder/a.coffee
#
# Error: Cannot find module '../b'
#   at Function.Module._resolveFilename (module.js:338:15)
#   at Function.Module._load (module.js:280:25)
#   at Module.require (module.js:364:17)
#   at require (module.js:380:17)
#   at Object.<anonymous> (/Users/test/folder/a.coffee:1:1)
#   at Module._compile (module.js:456:26)

© Stack Overflow or respective owner

Related posts about node.js

Related posts about coffeescript