其他人有幸在 Cloud9 ide 中使用 flatironjs 吗?
在我的server.js文件中,我有:
require("coffee-script");
var app = require("./app");
app.listen(process.env.PORT);
然后在我的app.coffee文件中,我有:
flatiron = require "flatiron"
director = require "director"
app = flatiron.app
app.use flatiron.plugins.http
module.exports = app.router.get "/", ->
res.writeHead 200, { "Content-Type": "text/plain" }
res.end "Hello world!\n"
当我尝试在 Cloud9 IDE 中运行它时,我得到以下信息:
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
**^ ReferenceError: window is not defined**
at Object. (/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/lib/eventemitter2.js:547:63)
at Module._compile (module.js:411:26)
at Object..js (module.js:417:10)
at Module.load (module.js:343:31)
at Function._load (module.js:302:12)
at require (module.js:355:19)
at Object. (/node_modules/flatiron/node_modules/broadway/lib/broadway/app.js:11:14)
at Module._compile (module.js:411:26)
at Object..js (module.js:417:10)
at Module.load (module.js:343:31)
如果我在不使用 flatiron 的情况下创建标准 http 服务器,一切都会运行良好:
http = require "http"
module.exports = http.createServer (req, res) ->
res.writeHead 200, {'Content-Type': 'text/plain'}
res.end "Hello World\n"
想法?