Running an OpenShift node server: Getting error Application 'appname' failed to start (port 8080 not available)
<p>I am trying to run a server for a game I'm currently developing. I got the error <code>Application 'appname' failed to start (port 8080 not available)</code> when I run <code>$git push</code>. (I ran git add and git commit before). This is my server code: `</p>

<pre><code>//Lets require/import the HTTP module
var http = require('http');
//var fs = require("fs");
//var index = fs.readFileSync('test.txt');

//Lets define a port we want to listen to
const PORT=8081; 

//We need a function which handles requests and send response
function handleRequest(request, response){
    response.end("hi");
}

//Create a server
var server = http.createServer(handleRequest);

//Lets start our server
server.listen(PORT, "127.0.0.1",function(){
    //Callback triggered when server is successfully listening.
    console.log("Server listening on: http://localhost:%s", PORT);
});
</code></pre>

<p>According to the research I've done you will get the port unavailable error if there is an error in your code, but I have tested to run the app locally on my computer, and it runs fine(I am able to connect and I see the message "hi"). The reason I have commented out the file system (fs) thing is because I wanted to test if the problem was because the OpenShift app didn't have fs installed (which it wasn't). I also tried running an entirely empty server, but i still get the same error. Therefore I don't think that the problem lies in any missing packages. I've checked if there already is something running on port 8080, but I don't see anything.</p>

<p>package.json:</p>

<pre><code>{
  "name": "OpenShift-Sample-App",
  "version": "1.0.0",
  "description": "OpenShift Sample Application",
  "keywords": [
    "OpenShift",
    "Node.js",
    "application",
    "openshift"
  ],
  "author": {
    "name": "OpenShift",
    "email": "ramr@example.org",
    "url": "http://www.openshift.com/"
  },
  "homepage": "http://www.openshift.com/",
  "repository": {
    "type": "git",
    "url": "https://github.com/openshift/origin-server"
  },

  "engines": {
    "node": "&gt;= 0.6.0",
    "npm": "&gt;= 1.0.0"
  },

  "dependencies": {
    "express": "~3.4.4"
  },
    "scripts": {
     "start": "node htmlServer.js"
  },
  "devDependencies": {},
  "bundleDependencies": [],
  "private": true,
  "main": "htmlServer.js"
}
</code></pre>

<p>Error log:</p>

<pre><code>warning: push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behavior, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.

Since Git 2.0, Git defaults to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

Counting objects: 3, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 332 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Stopping NodeJS cartridge
remote: Sat Jul 02 2016 14:17:48 GMT-0400 (EDT): Stopping application 'griffinsmod' ...
remote: Sat Jul 02 2016 14:17:49 GMT-0400 (EDT): Stopped Node application 'griffinsmod'
remote: Saving away previously installed Node modules
remote: Building git ref 'master', commit 07b3114
remote: Building NodeJS cartridge
remote: npm info it worked if it ends with ok
remote: npm info using npm@1.4.28
remote: npm info using node@v0.10.35
remote: npm info preinstall OpenShift-Sample-App@1.0.0
remote: npm info build /var/lib/openshift/5777be422d5271bc8b00018f/app-root/runtime/repo
remote: npm info linkStuff OpenShift-Sample-App@1.0.0
remote: npm info install OpenShift-Sample-App@1.0.0
remote: npm info postinstall OpenShift-Sample-App@1.0.0
remote: npm info prepublish OpenShift-Sample-App@1.0.0
remote: npm info ok 
remote: Preparing build for deployment
remote: Deployment id is 6f6c7880
remote: Activating deployment
remote: Starting NodeJS cartridge
remote: Sat Jul 02 2016 14:18:15 GMT-0400 (EDT): Starting application 'griffinsmod' ...
remote: Waiting for application port (8080) become available ...
remote: Application 'griffinsmod' failed to start (port 8080 not available)
remote: -------------------------
remote: Git Post-Receive Result: failure
remote: Activation status: failure
remote: Activation failed for the following gears:
remote: 5777be422d5271bc8b00018f (Error activating gear: CLIENT_ERROR: Failed to execute: 'control start' for /var/lib/openshift/5777be422d5271bc8b00018f/nodejs
remote: #&lt;IO:0x000000011ac290&gt;
remote: #&lt;IO:0x000000011ac218&gt;
remote: )
remote: Deployment completed with status: failure
remote: postreceive failed
To ssh://5777be422d5271bc8b00018f@griffinsmod-snowballdynamics.rhcloud.com/~/git/griffinsmod.git/
   a2fb4f6..07b3114  master -&gt; master
</code></pre>

<p>I haven't really cared about censoring any info, I hope that nobody hacks anything because of the error log, and sorry if this question is very long... Also sorry if this sounds noobish, I started using OpenShift and GitHub yesterday. If you have any questions or want some other info just comment! I would deeply appreciate any help I could get! :) </p>