簡體   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