Wednesday, April 9, 2014

Openshift Add --harmony flag to NodeJs

Trying to run Koajs or ES6 code with --harmony flag but getting 503 error on Openshift? Here’s how to solve it.

Get custom NodeJs cartridge

I’m using this one below instead of the orignal one.

rhc app create myapp nodejs-0.10 --from-code=git://github.com/ryanj/nodejs-custom-version-openshift.git

Change package.json

  "engines": {
    "node": ">= 0.11.12", //change this to 0.11.x for harmony
    "npm": ">= 1.0.0"
  },
  ...
  ...
  "scripts": {
    "start": "node --harmony server.js"
  },
  "main": " --harmony server.js" // Just add harmony flag here for Openshift deployment

Now push your code up to Openshift. It will run --harmony nicely.






Copyright © Zev23.com 2014 All Rights Reserved. No part of this website may be reproduced without Zev23.com’s express consent.

No comments: