Search code examples
node.jscloud-foundryrestify

Restify on Cloudfoundry 'invalid ELF header'


I'm deploying a node.js app to Cloudfoundry, the only module dependency is restify. I've tried pushing it with my local node_modules directory and also using npm shrinkwrap and 'ignoreModules' in cloudfoundry.json but always end up with this in the stdout.log:

{ stack: [Getter/Setter],
  arguments: undefined,
  type: undefined,
  message: '/var/vcap/data/dea/apps/myapp-0-6f9cf62f9bbe58f5d2eb13a94acb5d3a/app/node_modules/restify/node_modules/dtrace-provider/build/Release/DTraceProviderBindings.node: invalid ELF header' }

Any ideas? Thanks in advance :)

EDIT: sorry i mean 'ignore*Node*Modules'


Solution

  • My guess is the module is compiled for your local architecture (say x86), and the server trying to run it is a different architecture (say 64 bit). Node modules can have C++ extensions in them that npm will handle building, you can't necessarily just move the binaries in the node_modules folder from one platform to another, you need to recompile them.

    I don't know enough about Cloudfoundry to tell you how to do that though, hopefully someone else has a better answer.