I am following the steps described in this repository but I can't seem to make it work. When I look into my env file the nodejs version is still .6.20
My node js version file is the default one, so the node version .8.9 should be running. Any idea why this is happening?
My marker file:
0.8.9
Debug output when I try to start my application
==> nodejs/logs/node.log <==
npm ERR! node -v v0.6.20
npm ERR! npm -v 1.1.37
npm ERR! code ELIFECYCLE
npm ERR! message [email protected] start: `node server.js`
npm ERR! message `sh "-c" "node server.js"` failed with 1
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /var/lib/openshift/51ba8386e0b8cd2873000002/app-root/runtime/repo/npm- debug.log
npm ERR! not ok code undefined
npm ERR! not ok code 1
Just for the sake of completeness. My package.json file
{
"name": "application-name",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node server.js"
},
"dependencies": {
"express": "3.2.5",
"mustache": "*",
"request" : "*",
"buildify":"*",
"cheerio" : "*",
"slugs" : "*",
"to-markdown":"*",
"consolidate":"*"
}
}
The app runs locally just fine.
I like this version of the nodejs starter code better: https://github.com/ryanj/nodejs-custom-version-openshift
It contains a newer version of the .openshift application build hooks for nodejs. It will read the Marker file, but also has support for reading directly from your package.json file's engines attribute to compile your Nodejs runtime.
"engines": {
"node": ">= 0.10.0",
"npm": ">= 1.0.0"
},
I'm hoping to get this merged in as the default .openshift folder content for all nodejs apps on OpenShift.
You'll also want to make sure that you are binding to the NEW environment variables: OPENSHIFT_NODEJS_IP and OPENSHIFT_NODEJS_PORT. These were recently renamed.
I usually add something like this to my application code, allowing it to run anywhere:
var ip_addr = process.env.OPENSHIFT_NODEJS_IP || '127.0.0.1';
var port = process.env.OPENSHIFT_NODEJS_PORT || '8080';
OpenShift currently shows you the output from npm start, which may not reveal all of your application's output. For additional debugging info, you could try starting your app manually:
rhc app stop APP_NAMErhc ssh APP_NAMEcd $OPENSHIFT_REPO_DIRpackage.json file's scripts.start attribute.Hopefully that gives you a bit more visibility into what is going on.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With