title: Error: /app/node_modules/bcrypt/lib/binding/bcrypt_lib.node: invalid ELF header
body: <p>I am trying to deploy my REST API to heroku. However, the application is not working. In the application log, i got this</p>
  
  <pre><code>Process exited with status 1
  2019-09-23T01:09:55.744676+00:00 heroku[web.1]: Starting process with command `node server.js`
  2019-09-23T01:09:58.446510+00:00 heroku[web.1]: Process exited with status 1
  2019-09-23T01:09:58.468276+00:00 heroku[web.1]: State changed from starting to crashed
  2019-09-23T01:09:58.370869+00:00 app[web.1]: internal/modules/cjs/loader.js:807
  2019-09-23T01:09:58.370888+00:00 app[web.1]: return process.dlopen(module, path.toNamespacedPath(filename));
  2019-09-23T01:09:58.370890+00:00 app[web.1]: ^
  2019-09-23T01:09:58.370892+00:00 app[web.1]: 
  2019-09-23T01:09:58.370894+00:00 app[web.1]: Error: /app/node_modules/bcrypt/lib/binding/bcrypt_lib.node: invalid ELF header
  2019-09-23T01:09:58.370896+00:00 app[web.1]: at Object.Module._extensions..node (internal/modules/cjs/loader.js:807:18)
  2019-09-23T01:09:58.370898+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:653:32)
  2019-09-23T01:09:58.370900+00:00 app[web.1]: at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
  2019-09-23T01:09:58.370902+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:585:3)
  2019-09-23T01:09:58.370904+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:692:17)
  2019-09-23T01:09:58.370906+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:25:18)
  2019-09-23T01:09:58.370909+00:00 app[web.1]: at Object.&lt;anonymous&gt; (/app/node_modules/bcrypt/bcrypt.js:6:16)
  2019-09-23T01:09:58.370910+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:778:30)
  2019-09-23T01:09:58.370912+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
  2019-09-23T01:09:58.370915+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:653:32)
  2019-09-23T01:09:58.370917+00:00 app[web.1]: at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
  2019-09-23T01:09:58.370919+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:585:3)
  2019-09-23T01:09:58.370921+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:692:17)
  2019-09-23T01:09:58.370923+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:25:18)
  2019-09-23T01:09:58.370924+00:00 app[web.1]: at Object.&lt;anonymous&gt; (/app/routes/auth.js:6:16)
  2019-09-23T01:09:58.370926+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:778:30)
  </code></pre>
  
  <p>This seems to have something to do with <code>bcrypt</code> module. I tried the solutions suggested here: <a href="https://github.com/kelektiv/node.bcrypt.js/issues/595" rel="nofollow noreferrer">https://github.com/kelektiv/node.bcrypt.js/issues/595</a> and <a href="https://github.com/kelektiv/node.bcrypt.js/issues/635" rel="nofollow noreferrer">https://github.com/kelektiv/node.bcrypt.js/issues/635</a></p>
  
  <p>such as: <code>npm rebuild bcrypt --build-from-source</code></p>
  
  <p>here is <code>package.json</code> file:</p>
  
  <pre><code>{
    "name": "server",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
      "test": "echo \"Error: no test specified\" &amp;&amp; exit 1"
    },
    "keywords": [],
    "author": "",
    "license": "ISC",
    "dependencies": {
      "bcrypt": "^3.0.6",
      "body-parser": "^1.18.3",
      "cors": "^2.8.4",
      "cron": "^1.7.2",
      "express": "^4.16.3",
      "jsonwebtoken": "^8.3.0",
      "jwt-simple": "^0.5.6",
      "mapnik": "^4.3.1",
      "mkdirp": "^0.5.1",
      "mongoose": "^5.7.1",
      "multer": "^1.4.1",
      "nodemailer": "^6.3.0",
      "request": "^2.88.0",
      "ug": "0.0.8"
    }
  }
  
  </code></pre>
  
  <p>None of those solutions worked for me! How can I solve this problem?</p>