Openshift - 部署Keystone.JS时缺少模块

时间:2015-04-18 08:52:44

标签: javascript openshift node-modules keystonejs

我正在尝试安装keystone.js,但不断错过模块错误,有人可以帮忙吗?我已经更新了我的package.json以包含cloud-env dependancies,但仍然没有快乐。很少有文档可以将KS部署到Openshift。

Error: Cannot find module 'keystone'
 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/5501b0c04382ecfefe0000a2/app-root/runtime/repo/web.js:1:78)
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)
DEBUG: Program node web.js exited with code 8
DEBUG: Starting child process with 'node web.js'

的package.json:

{
  "name": "node",
  "version": "0.0.0",
 "private": true,
 "dependencies": {
   "cloud-env": "^0.1.0",
   "keystone": "latest",
   "underscore": "latest"
  },
  "devDependencies": {
    "grunt": "~0.4.4",
    "grunt-express-server": "~0.4.17",
    "grunt-contrib-jshint": "~0.7.1",
    "grunt-contrib-compass": "^1.0.1",
    "grunt-contrib-csslint": "^0.3.1",
"grunt-contrib-cssmin": "^0.11.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-cssstats": "^1.0.1",
"grunt-stats": "^0.1.0",
"jshint-stylish": "~0.1.3",
"load-grunt-tasks": "~0.4.0",
"load-grunt-configs": "^0.4.1",
"grunt-node-inspector": "~0.1.5",
"time-grunt": "~0.3.1",
"grunt-concurrent": "~0.5.0",
"grunt-nodemon": "~0.2.1",
"open": "0.0.5"
   },
   "engines": {
     "node": ">=0.10.22",
   "npm": ">=1.3.14"
   },
  "scripts": {
    "start": "node web.js"
  },
    "main": "web.js"
  }

2 个答案:

答案 0 :(得分:2)

这是一个迟到的答案,但今天我遇到了同样的问题,以下内容对我有用:

rhc ssh <app>
cd $OPENSHIFT_REPO_DIR
npm install

将应用程序推送到openshift时,可能会出现问题。这样您就可以手动修复包。

答案 1 :(得分:0)

我遇到了同样的问题。根据我的研究,关闭ssh连接的问题似乎是其他人在使用各种语言的小型openhift齿轮进行构建时遇到的问题(我读了一些视图它确实运行安装正确如果你'重新中等档位或以上)。我没有得到npm install来完成使用@ barney765的解决方案但是:每次运行时我都会遇到类似的“连接关闭”问题。

升级到中等大小的设备并不是我准备做的事情,我的解决方法是将我的生产node_modules提交给git,因此一旦部署到openshift就不需要npm install

提交您的node_modules does have its drawbacks时, openshift文档会出现to suggest this is as a viable approach (read the "node_modules" heading)