TL;DR Make sure that your node_modules directory is included in the .dockerignore file.

ELSs gone nuts

Kept getting this error on production:

nodejs error node_expat.node: invalid ELF header docker

remove node_modules rebuild docker image remove docker images: docker rmi docker images -qcle

  • Did not happen in a different driver (digitalocean)
  • later found out did not happen in a newly created EC2 instance
    • i created a new ec2 instance and the same error persisted
  • later turned out it did not happen