Reputation: 16000
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.
Upvotes: 2
Views: 2991
Reputation: 587
I had the same problem and on the beginning i wasn't able to solve it using source code from https://github.com/ryanj/nodejs-custom-version-openshift, but reading the push output I noticed some permission problems. So for other people that is having the same issue, just go into:
cd .openshift\action_hooks
and run this command:
git update-index --chmod=+x *
It gives the permissions to run commands that upgrades node version
Upvotes: 1
Reputation: 1982
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_NAME
rhc ssh APP_NAME
cd $OPENSHIFT_REPO_DIR
package.json
file's scripts.start
attribute.Hopefully that gives you a bit more visibility into what is going on.
Upvotes: 6
Reputation: 2663
Did you see anything like this in your "git push" output?
remote: - Checking to see if Node.js version 0.8.9 is installed ...
remote: - Downloading and extracting http://nodejs.org/dist/v0.8.9/node-v0.8.9-linux-x64.tar.gz ...
remote: % Total % Received % Xferd Average Speed Time Time Time Current
remote: Dload Upload Total Spent Left Speed
remote: 100 4578k 100 4578k 0 0 31.4M 0 --:--:-- --:--:-- --:--:-- 33.8M
and towards the bottom of the bottom, something like:
remote: - Using Node.js version 0.8.9, checking app URI ...
remote: - test URI = http://mynode-sannam.rhcloud.com/env
remote: - Version from test URI =
remote:
remote: - Checking to see if Node.js version 0.8.9 is installed ...
I tried the same instructions and it seems to have worked. Check my env here: http://mynode-sannam.rhcloud.com/env
Please redo your steps one more time.
Upvotes: 1
Reputation: 4478
Maybe this will help. There are subtle differences. See also the comments.
Upvotes: 1