Invalid ELF header Node js with couchbase db

一笑奈何 提交于 2020-01-05 10:05:33

问题


I've seen a handful of posts about this issue but the results all seem to be specific to the users configuration. I'm using couchbase db with a express js server. When I run the code locally (windows) it works fine. The database it self is hosted on a linux server. When I deploy the code to our testing environment ( linux ), I'm getting this error when I try to run "node server.js":

/var/www/html/BTRnode/node_modules/couchbase/node_modules/bindings/bindings.js:83
        throw 8
Error: /var/www/html/BTRnode/node_modules/couchbase/build/Release/couchbase_impl.node: invalid ELF header
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:364:17)
    at ....

I'm completely lost on what to do in this situation. As mentioned before, it seemed to me like all the fixes in other peoples situation was some system configuration. I'm not sure what to post here to help you see any configuration that might help, but I can sure add it if needed. Also if there be a more general solution or error that I'm committing that'd be helpful to know to.

Question: What do I need to do to get this to run?


回答1:


The "invalid ELF header" error happens when you compile modules on one architecture and then try to run them on another. I'm guessing you're copying your entire project folder over, rather than installing the architecture-specific node modules on the testing environment. Make sure your package.json file is configured correctly, delete (or better yet, don't copy) your node_modules folder, and then run npm install on the target environment. This will pull and compile that modules for the particular environment.

Here is the documentation page about configuring and using your package.json: https://docs.npmjs.com/getting-started/using-a-package.json



来源:https://stackoverflow.com/questions/34822326/invalid-elf-header-node-js-with-couchbase-db

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