Bomber
Bomber

Reputation: 10957

Openshift - missing modules when deploying Keystone.JS

I'm trying to install keystone.js, but keep getting missing module errors, can any one please help? I have updated my package.json to include cloud-env dependancies, but still no joy. There's very little documentation available for deploying KS to 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"
  }

Upvotes: 0

Views: 304

Answers (2)

rogersillito
rogersillito

Reputation: 941

I ran into the same problem. From my research, problems with closed ssh connections seem to be something other people have run into when doing builds on small openshift gears across various languages (I read some views that it does run the install ok if you're on medium gears or above). I failed to get an npm install to complete using the solution from @barney765 however: I would get similar "connection closed" issues each time I ran it.

As upgrading to a medium size gear wasn't really something I was prepared to do, my workaround was to commit my production node_modules to git so no npm install is required once deployed to openshift.

While committing your node_modules does have its drawbacks - the openshift documentation appeears to suggest this is as a viable approach (read the "node_modules" heading).

Upvotes: 0

barney765
barney765

Reputation: 447

It's a late answer but today I had the same problem and the following worked for me:

rhc ssh <app>
cd $OPENSHIFT_REPO_DIR
npm install

Probably something went wrong when pushing the app to openshift. This way you can manually fix packages.

Upvotes: 2

Related Questions