If you are running your nodejs application inside a docker container, and you get an error with a message like:

invalid ELF header

Usually, it means that you are carrying over the local node_modueles and some dependency has native dependencies which need to be built in your docker container.

Error: /src/node_modules/nodegit/build/Release/nodegit.node: invalid ELF header
    at Error (native)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/src/node_modules/nodegit/lib/nodegit.js:9:12)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/src/lib/git.js:6:11)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)

Use .dockerignore:

node_modules