I am trying to run my app based on cloak on RedHat Openshift. But I can't even run simple code like this:
var cloak = require("cloak");
var _ = require("underscore");
var connect = require("connect");
cloak.configure({
port: process.env.OPENSHIFT_NODEJS_PORT || 8080,
autoJoinLobby:false,
enter code here`});
cloak.run();
I can run it on my local pc easily (ofc without the constant), but on Openshift, I always get this error:
/var/lib/openshift/550eddc0fcf933a5d9000036/app-root/runtime/repo/node_modules/cloak/node_modules/socket.io/lib/manager.js:106 server.on('error', function(err) { ^ TypeError: Object 8080 has no method 'on' at new Manager (/var/lib/openshift/550eddc0fcf933a5d9000036/app-root/runtime/repo/node_modules/cloak/node_modules/socket.io/lib/manager.js:106:10) at Object.exports.listen (/var/lib/openshift/550eddc0fcf933a5d9000036/app-root/runtime/repo/node_modules/cloak/node_modules/socket.io/lib/socket.io.js:78:10) at Object.module.exports.cloak.run (/var/lib/openshift/550eddc0fcf933a5d9000036/app-root/runtime/repo/node_modules/cloak/index.js:78:21) at Object. (/var/lib/openshift/550eddc0fcf933a5d9000036/app-root/runtime/repo/server.js:23:7) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16)
I looked into socket.io and the problem is in this:
server = require('http').createServer();
On local machine, value of server is changed from 8080 to [object Object], so manager.js gets wrong input. While on Openshift, it just does nothing.
Why does it do this to me? :D