2

I'm using ES6 with babel-node to create my app and I require my app to start with the command babel-node app.js. This command is listed in scripts: start in my package.json so the command npm start runs the correct command.

Open shift starts node apps with node + what ever script is set in the main property of your package.json file. In my case its "main": "app.js". So this command is run node app.js.

The server is choking on the first ES6 it encounters which makes sense. I can't figure out how to configure openshift to run babel-node or npm start to start up my app.

Here is my package.json file -> https://gist.github.com/jkinman/2cc57ce5fae5817d6bca

Joel
  • 1,309
  • 2
  • 10
  • 20
  • used this great yeoman generator to setup my project https://github.com/ghaiklor/generator-sails-rest-api – Joel Nov 10 '15 at 18:46
  • you might want to include that in your question since comments disappear more easily than questions – royhowie Nov 10 '15 at 22:58

1 Answers1

6

You shouldn't run your server with babel-node, which is memory intensive and not meant for production. Instead, you should use the require hook by creating a file start.js (name unimportant) with the following content:

require('babel-core/register')
require('./app.js')
// or server.js or whatever you use to normally start you app

Then you can start your server with node start.js.

royhowie
  • 11,075
  • 14
  • 50
  • 67