繁体   English   中英

我如何需要CoffeeScript文件?

[英]How can I require a CoffeeScript file?

我正在尝试遵循CoffeScript的本教程

我打开终端,导航到存在simpleMath.coffee的目录并运行node然后尝试var SimpleMath = require('./simpleMath'); ,导致以下错误:

Error: Cannot find module 'simpleMath'
    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 repl:1:18
    at REPLServer.self.eval (repl.js:110:21)
    at repl.js:249:20
    at REPLServer.self.eval (repl.js:122:7)
    at Interface.<anonymous> (repl.js:239:12)
    at Interface.EventEmitter.emit (events.js:95:17)

我也尝试过simpleMath ,没有./

您需要先将coffeee编译成js。 请参阅https://github.com/oklai/koala,它捕获并在GUI中编译文件-并在失败时发送通知。 真的很好

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM