起動スクリプトの構造 (Webstorm 構成) が異なるため、サーバーでこのエラーが発生します。
Error: Cannot find module '/var/lib/openshift/56c74bc61a003e5c2200015e/app-root/runtime/repo/server.js'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:134:18)
at node.js:962:3
DEBUG: Program node server.js exited with code 1
DEBUG: Starting child process with 'node server.js'
私のpackage.jsonは(「main」:「./bin/www」を手動で追加しました)
{
"name": "app",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"main": "./bin/www",
"dependencies": {
"body-parser": "~1.13.2",
"cookie-parser": "~1.3.5",
"debug": "~2.2.0",
"express": "~4.13.1",
"jade": "~1.11.0",
"morgan": "~1.6.1",
"serve-favicon": "~2.3.0"
}
}
上記の構成でオープンシフトを実行するようにアドバイスしてください。
編集
実際に追加すると"main": "./bin/www"
、このエラーが発生しました
DEBUG: Starting child process with 'node ./bin/www'
Port 8080 is already in use
DEBUG: Program node ./bin/www exited with code 1
DEBUG: Starting child process with 'node ./bin/www'
Port 8080 is already in use
DEBUG: Program node ./bin/www exited with code 1
DEBUG: Starting child process with 'node ./bin/www'
Port 8080 is already in use
DEBUG: Program node ./bin/www exited with code 1
DEBUG: Starting child process with 'node ./bin/www'
私のwwwファイル
var port = normalizePort(process.env.OPENSHIFT_NODEJS_PORT || '3000');
app.set('port', port);
/**
* Normalize a port into a number, string, or false.
*/
function normalizePort(val) {
var port = parseInt(val, 10);
if (isNaN(port)) {
// named pipe
return val;
}
if (port >= 0) {
// port number
return port;
}
return false;
}