0
我正在嘗試關注CoffeScript的tutorial。我如何需要一個CoffeeScript文件?
我打開終端,導航到的目錄中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
爲好,而不./
。
您是否看了NodeJS文檔,查看http://nodejs.org/api/modules.html – elclanrs
當然您需要將您的咖啡編譯爲js,然後才能在NODE.js中使用它;-) – andi
嘗試開始'coffee' repl而不是'node' – Bergi