Restify on Cloudfoundry 'invalid ELF header'

十年热恋 提交于 2019-12-11 03:19:49

问题


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'


回答1:


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.




回答2:


I had a similar issue setting up a dev Docker environment. I wanted to mount my source files on the docker image, but have a node_modules directory compiled just for the docker image. When I made a new directory on the docker image, npm install in that directory, and then used soft links for some of my source code I saw the same behavior.

Solution: don't use soft links.



来源:https://stackoverflow.com/questions/12592147/restify-on-cloudfoundry-invalid-elf-header

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