0

I'm trying to VMC push Calipso onto an instance of Micro Cloud Foundry that I have, and I'm getting thrown up by an error saying

Unable to load shared library /var/vcap/data/dea/apps/{App-Name&ID}/app/node_modules/bcrypt/build/Release/bcrypt_lib.node 
 at Object..node (module.js:463:11)
    at Module.load (module.js:351:31)
    at Function._load (module.js:310:12)
    at Module.require (module.js:357:17)
    at require (module.js:368:17)
    at bindings (/var/vcap/data/dea/apps/Apptain-0-cb7703ae25d61741a91f9a828959ea6e/app/node_modules/bcrypt/node_modules/bindings/bindings.js:74:15)
    at Object.<anonymous> (/var/vcap/data/dea/apps/{App-Name&ID}/app/node_modules/bcrypt/bcrypt.js:1:96)
    at Module._compile (module.js:432:26)
    at Object..js (module.js:450:10)
    at Module.load (module.js:351:31)

Line 74 of bcrypt/node_modules/bindings/bindings.js is

var b = require(n)

but it's odd because the whole block is

var tries = []
    , i = 0
    , l = opts.try.length
    , n

  for (; i<l; i++) {
    n = join.apply(null, opts.try[i].map(function (p) {
      return opts[p] || p
    }))
    tries.push(n)
    try {
      var b = require(n)
      b.path = n
      return b
    } catch (e) {
      if (!/not find/i.test(e.message)) {
        throw e
      }
    }
  }

so any exception should be getting caught and if necessary thrown farther down. I know I'm pretty far off the map, but any help anyone can offer would be appreciated. I can run local without issue, but start on MicroCloud fails.

Joe
  • 187
  • 2
  • 4

1 Answers1

1

Disclaimer: I am in a no way a node.js expert, but it seems there is something wrong with the path of the lib, namely the part "{App-Name&ID}".

As bcrypt is a native dep, there is special handling to be taken care of. All of this is explained here : http://blog.cloudfoundry.com/2012/05/24/cloud-foundry-supports-node-js-modules-with-npm/

You may want to check that out, if you haven't already. Also, I'm not quite sure if what is described in that blog post applies to (your version of) micro CloudFoundry. You may want to give it a try on the real cloudfoundry.com site to see if it solves your problem.

ebottard
  • 1,987
  • 2
  • 12
  • 14
  • "{App-Name&ID}" is just a placeholder I used for the actual name and ID of my App. { "ignoreNodeModules" : true } – Joe Oct 05 '12 at 15:48
  • I do have a cloudfoundry.json file containing the json { "ignoreNodeModules" : true }, and I also have an npm-shrinkwrap.json, so I would hope it would be ignoring the node_modules folder but it is not and if I pull bcrypt out of node_modules it fails looking for it. I'm right in line with the below blogs posts that was published in August, with the only difference being that I'm not deploying to a cloudfoundry.com subdomain so my microcloud is in offline mode (how I got it to work with regular domains). – Joe Oct 05 '12 at 15:58
  • http://blog.cloudfoundry.com/2012/08/14/cloud-foundry-now-supports-auto-reconfiguration-for-node-js-applications/ – Joe Oct 05 '12 at 16:00
  • 1
    Ok, I'm pretty sure the issue comes from the fact that micro (I guess you have 1.2.0) predates support for native modules. Can you try deploying on cf.com to confirm? – ebottard Oct 05 '12 at 21:03
  • Eric is correct. The next refresh of Micro Cloud Foundry should resolve this issue. – Andy Piper Oct 08 '12 at 11:59
  • You are correct Eric. Anyone know when the next MicroCloud release may come? – Joe Oct 14 '12 at 03:45
  • You may be interested in knowing that not only is the new MCF available, but they will keep coming at regular basis now: http://blog.cloudfoundry.com/2012/11/08/new-release-of-micro-cloud-foundry/ – ebottard Nov 09 '12 at 14:53
  • You can also use a native javascript bcrypt implementation to avaoid compilation issues http://stackoverflow.com/a/15912043/1095114 – Noah Jun 03 '13 at 23:07