Invalid ELF header with node bcrypt on AWSBox

2019-05-26 11:00发布

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?

3条回答
时光不老,我们不散
2楼-- · 2019-05-26 11:40

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

查看更多
Lonely孤独者°
3楼-- · 2019-05-26 11:49

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

查看更多
smile是对你的礼貌
4楼-- · 2019-05-26 11:50

[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
查看更多
登录 后发表回答