Question

I have a SailsJS app, with much of it written in CoffeeScript. When running it in Prod mode using "sails lift" all is good.

Running it with forever doesn't work. If I examine the logs, the problem seems to be with node running app.js

/var/www/obelix/api/models/Catalogue.coffee:2 attributes: ^ SyntaxError: Unexpected token : at Module._compile (module.js:439:25) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) at require (module.js:380:17) at /var/www/obelix/node_modules/sails/node_modules/include-all/index.js:96:53 at Array.forEach (native) at requireAll (/var/www/obelix/node_modules/sails/node_modules/include->all/index.js:40:9) at buildDictionary >(/var/www/obelix/node_modules/sails/lib/moduleloader/index.js:60:36)

Is it possible to get a sails+coffeescript app to run using node/forever?

Was it helpful?

Solution

The problem is that coffee-script support doesn't work unless you're using sails lift. Try requiring coffee-script in your app.js file:

// Start sails and pass it command line arguments
require('coffee-script');
require('sails').lift(require('optimist').argv);

Then npm install coffee-script --save

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top