Openshift node app failed to start

偶尔善良 提交于 2019-12-24 03:55:14

问题


I am failing to start my node-based application on Openshift. The application starts OK locally but node's automatic deployment (on push to the remote master repo) hits a cyclic problem with the log;

DEBUG: Running node-supervisor with
DEBUG:   program './app/server.js'
DEBUG:   --watch '/var/lib/openshift/53dab282e0b8cdd367000131/app-root/data/.nodewatch'
DEBUG:   --ignore 'undefined'
DEBUG:   --extensions 'node|js|coffee'
DEBUG:   --exec 'node'
DEBUG: Starting child process with 'node ./app/server.js'
DEBUG: Watching directory '/var/lib/openshift/53dab282e0b8cdd367000131/app-root/data/.nodewatch' for changes.
module.js:340
    throw err;
          ^
Error: Cannot find module 'underscore.string'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/var/lib/openshift/53dab282e0b8cdd367000131/app-root/runtime/repo/node_modules/sequelize/lib/utils.js:5:26)
    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 Module.require (module.js:364:17)
DEBUG: Program node ./app/server.js exited with code 8
DEBUG: Starting child process with 'node ./app/server.js'
module.js:340
    throw err;
          ^
Error: Cannot find module 'underscore.string'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/var/lib/openshift/53dab282e0b8cdd367000131/app-root/runtime/repo/node_modules/sequelize/lib/utils.js:5:26)
    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 Module.require (module.js:364:17)
DEBUG: Program node ./app/server.js exited with code 8

...this loop continues indefinitely, the app reports "Started" but clearly it's failed to initialize sequelize.js.

I'm a bit lost and loosing the faith in Openshift hosting at this point. I think this might be the last straw. Any advice?

Here is my app's package.json;

{
  "name": "OceanLife-API",
  "version": "1.1.0",
  "description": "OceanLife API",
  "keywords": [
    "OceanLife",
    "API",
    "tide",
    "swell",
    "weather"
  ],
  "author": {
    "name": "David Branton",
    "email": "oceanlife.development@gmail.com",
    "url": "http://oceanlifeapi-brantapps.rhcloud.com/"
  },
  "homepage": "http://oceanlifeapi-brantapps.rhcloud.com/",
  "repository": {
    "type": "git",
    "url": "https://github.com/openshift/origin-server"
  },
  "engines": {
    "node": ">= 0.10.25",
    "npm": ">= 1.3.24"
  },
  "dependencies": {
    "express": "~3.4.8",
    "sleep": "~1.1.8",
    "aglio": "~1.14.0",
    "sequelize": "~1.7.10",
    "lodash": "~2.4.1",
    "mysql": "~2.4.3",
    "cheerio": "~0.17.0",
    "moment": "~2.9.0",
    "moment-timezone": "~0.2.5",
    "tzwhere": "~1.0.0",
    "line-reader": "~0.2.4"
  },
  "scripts": {
    "lint": "./node_modules/.bin/jshint app/**/*.js",
    "pretest": "npm run-script lint",
    "test": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- --recursive -R spec"
  },
  "devDependencies": {
    "istanbul": "~0.3.5",
    "rewire": "~2.1.3",
    "sinon": "~1.12.2",
    "mocha": "~2.1.0",
    "nock": "~0.57.0",
    "dredd": "~0.3.14",
    "jshint": "~2.5.11"
  },
  "bundleDependencies": [],
  "private": true,
  "main": "./app/server.js"
}

回答1:


I've come back to this recently and have managed to get it working by using the community built Node v0.12 cartridge. If you are having similar issues I'd recommend ditching the "official" Node v0.1 app cartridge and trying again.

Sweet - free hosting of my node app! :D



来源:https://stackoverflow.com/questions/28016236/openshift-node-app-failed-to-start

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!