2

Just getting started with Node.js and I'm using the Geddy framework (I like the similarity to Rails). But I'm having some trouble getting it to work properly with CoffeeScript. I see Geddy is now "supporting" coffee files. But when I start converting even the default js to coffee, I get errors:

/usr/local/lib/node_modules/geddy/lib/app.js:108
      ctor.origPrototype = ctor.prototype;
                               ^
TypeError: Cannot read property 'prototype' of undefined
at _registerControllers (/usr/local/lib/node_modules/geddy/lib/app.js:108:36)
at async.AsyncBase.runItem (/usr/local/lib/node_modules/geddy/node_modules/utilities/lib/async.js:108:10)
at async.AsyncBase.next (/usr/local/lib/node_modules/geddy/node_modules/utilities/lib/async.js:113:12)
at async.AsyncBase.execCallback (/usr/local/lib/node_modules/geddy/node_modules/utilities/lib/async.js:148:54)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)

I have CoffeeScript installed, but I don't really know what else I'm supposed to do here. The documentation on this is pretty much non-existant.

Any idea what I'm missing here?

David Link
  • 536
  • 3
  • 9
  • Try search issues https://github.com/mde/geddy/issues , wiki https://github.com/mde/geddy/wiki/_pages – Paul Verest Mar 01 '13 at 05:32
  • Thanks, Paul. I've already looked through it, no dice. – David Link Mar 01 '13 at 05:50
  • Looks like you're not exporting your controller. Maybe paste your code? Look at the [example](https://github.com/mde/geddy/blob/master/examples/todo_app_coffee/app/controllers/main.coffee) – Ven Mar 01 '13 at 13:56

2 Answers2

0

Have a look at geddy-coffee-templates. You can create a new base app from coffeescript. Adding a model and controller is working now, but the scaffold and resource generators are not working at the moment.

For an existing app, simply add a dependency to coffee-script on your package.json file. (Example). Then npm install.

Miguel Madero
  • 1,948
  • 13
  • 21
0

this question is probably a bit old but I just ran into this problem.

In my case, all I did was added a controller file called fruits.js but inside my fruits.js I defined it as:

var Fruit = function () {

...

};

exports.Fruit = Fruit;

The problem is in the naming of the file and the actual variable name not matching.

In my case, the simple fix was:

either rename "Fruit" to "Fruits" 

or

change the file name from "fruits.js" to "fruit.js"

So the lesson learned is Geddy expects the controller file name to match the actual variable definition inside the file.

Hope you were having the same problem.

Zhang
  • 11,549
  • 7
  • 57
  • 87