Anyone else having luck using flatironjs with the Cloud9 ide?
In my server.js file I have:
require("coffee-script");
var app = require("./app");
app.listen(process.env.PORT);
Then in my app.coffee file I have:
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"
When I attempt to run this in the Cloud9 IDE I get the following:
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)
If I create a standard http server without using flatiron everything runs great:
http = require "http"
module.exports = http.createServer (req, res) ->
res.writeHead 200, {'Content-Type': 'text/plain'}
res.end "Hello World\n"
Thoughts?
This is a bug in EventEmitter running on Solaris. You can see it as well if you just run an app on the latest version of Solaris, will crash with the same error message. You can use the patched EventEmitter2 that removes the check for the browser.
I created an issue for you.