2

I'm playing with awsbox and deploying my app shows these errors:

    /home/app/code/node_modules/mongoose-troop/node_modules/bcrypt/node_modules/bindings/bindings.js:79
            throw e
                  ^
    Error: /home/app/code/node_modules/mongoose-troop/node_modules/bcrypt/build/Release/bcrypt_lib.node: invalid ELF header
        at Object.Module._extensions..node (module.js:485:11)
        at Module.load (module.js:356:32)
        at Function.Module._load (module.js:312:12)
        at Module.require (module.js:362:17)
        at require (module.js:378:17)
        at bindings (/home/app/code/node_modules/mongoose-troop/node_modules/bcrypt/node_modules/bindings/bindings.js:74:15)
        at Object.<anonymous> (/home/app/code/node_modules/mongoose-troop/node_modules/bcrypt/bcrypt.js:1:97)
        at Module._compile (module.js:449:26)
        at Object.Module._extensions..js (module.js:467:10)
        at Module.load (module.js:356:32)
    warn: Forever detected script exited with code: 1
    warn: Forever restarting script for 1 time

Any idea how to resolve this?

cyberwombat
  • 38,105
  • 35
  • 175
  • 251

3 Answers3

3

[edit] I had the same error for another reason (see comments), just in case it works for someone else: I solved it by re-installing the bcrypt module by npm with this command:

npm install bcrypt
edelans
  • 8,479
  • 4
  • 36
  • 45
  • Thanks but it was mongoose-troop which itself calls bcrypt. I guess ones has to grep all modules to find bcrypt dependent packages – cyberwombat Jan 02 '14 at 22:58
  • 1
    @edelans I had this same issue, but with `bcrypt-as-promised`. I tried to `npm install bcrypt-as-promised` again from my Ubuntu 16.04 AWS box, but I kept getting the `invalid ELF header` error also. What fixed it for me, was deleting my entire `node_modules` folder, and re-installing all modules via `sudo npm install`. For some reason, despite grabbing fresh copies, the error persisted until I deleted the `node_modules` folder completely (in bash: `sudo rm -r node_modules`) and then reinstalled (`sudo npm install`). Hopefully this addition saves someone in the future some time! – twknab Feb 22 '17 at 12:32
1

Not sure what the best answer might be but I did find some post mentioning something about x86 vs 64 bit issues. I deleted the mongoose-troop module and called npm install from within the awsbox console and that seemed to have done it. Not sure how that will work as far as deploying to awsbox though. Might not work

cyberwombat
  • 38,105
  • 35
  • 175
  • 251
0

Please reinstall your bcrypt module by npm install then restart the server. Should be solved.