Created
July 8, 2011 16:31
-
-
Save mnylen/1072202 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
express = require 'express' | |
assetManager = require 'connect-assetmanager' | |
app = express.createServer | |
app.use assetManager |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'), | |
assetManager = require('connect-assetmanager'); | |
var app = express.createServer(); | |
app.use(assetManager); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ coffee app.coffee | |
TypeError: Object function (options){ | |
if ('object' == typeof options) { | |
return new HTTPSServer(options, Array.prototype.slice.call(arguments, 1)); | |
} else { | |
return new HTTPServer(Array.prototype.slice.call(arguments)); | |
} | |
} has no method 'use' | |
at Object.<anonymous> (/.../app.coffee:6:7) | |
at Object.<anonymous> (/.../app.coffee:7:4) | |
at Module._compile (module.js:402:26) | |
at Object.run (/usr/local/lib/node_modules/coffee-script/lib/coffee-script.js:62:19) | |
at /usr/local/lib/node_modules/coffee-script/lib/command.js:120:29 | |
at /usr/local/lib/node_modules/coffee-script/lib/command.js:90:26 | |
at [object Object].<anonymous> (fs.js:107:5) | |
at [object Object].emit (events.js:61:17) | |
at afterRead (fs.js:878:12) | |
at wrapper (fs.js:245:17) | |
$ node app.js | |
(no errors) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So the problem was that the CoffeeScript was translated to:
And of course it wouldn't work, because
app
was thecreateServer
function, not it's return value. To fix: add parenthesis aftercreateServer
(and any other method call that doesn't have any parameters, because CoffeeScript compiler can't determine what you want then)