我一直在将项目从Heroku迁移到AWS。我已经能够成功将项目成功上传到AWS上,没有任何错误,但是应用程序的运行状况被列为“已降级”。我一直在查看应用程序日志,并认为问题与我先在Mac上编写代码,然后在Linux AMI上编写Elastic Beanstalk有关。
"invalid ELF header" when using the nodejs "ref" module on AWS Lambda
但是,此帖子仅能诊断问题。没有提供解决方案。我知道将代码从Mac迁移到Linux时存在体系结构不匹配的情况。我正在寻找解决该问题的方法。
这是我的应用程序日志中的错误消息:
Error: /var/app/current/node_modules/bcrypt/lib/binding/bcrypt_lib.node: invalid ELF header
at Object.Module._extensions..node (internal/modules/cjs/loader.js:730:18)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/var/app/current/node_modules/bcrypt/bcrypt.js:6:16)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! beer@0.1.0 start: `node server/server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the beer@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/.npm/_logs/2019-04-15T00_54_06_983Z-debug.log