Can I run coffeescript in Heroku?

Michael Blume is right and you don’t need any extra code to run CoffeeScript node apps on heroku. This is how I did it:

Add the coffee-script in the current version to your dependencies in package.json. This might look somewhat like this:

{
  "name": "My-CoffeeScript-App-on-Heroku",
  "version": "0.0.1",
  "dependencies": {
    "coffee-script": "1.1.2"
  }
}

Then modify the entry for your node app in the Procfile to use coffee instead of node. For an app with only a single web entry this might look like this

web: coffee app.coffee

To test if this will work on Heroku, you can try it on localhost using the foreman gem:

$ gem install foreman
$ foreman start
21:13:36 web.1     | started with pid 4711

Then try a push to heroku and you will see something like this in the dependency installation:

-----> Installing dependencies with npm 1.0.8
       coffee-script@1.1.2 ./node_modules/coffee-script 
       jade@0.15.3 ./node_modules/jade 
       ├── mkdirp@0.0.6
       └── commander@0.1.0

Not sure if there are issues with that procedure but the method described above seems like overkill to me since you’re messing up your code for runtime environment stuff.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)