我有一个基于 next.js 框架的小型网站,我想将其部署在 AWS Elastic Beanstalk 上。
我关注了getting started docs这里的https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/GettingStarted.html
以及这里的https://nextjs.org/docs/deployment。然而,网站上的文档next.js并不深入。
所以我做了以下步骤:
npm run build在我的项目文件夹中 - 这生成了.next文件夹package.json里面的内容.next.next文件夹并压缩内容(因此所有文件都位于 zip 的根目录中)Create a web app并上传zip文件所有这一切都顺利进行,AWS Beanstalk 创建了环境。然后我收到了信息Healthstatus: Severe - 100.0 % of the requests are failing with HTTP 5xx.
所以我查看了日志并得到了以下信息:
Jan 2 19:44:38 ip-172-31-23-147 web: at /var/app/current/node_modules/next/dist/bin/next:27:115
Jan 2 19:44:38 ip-172-31-23-147 web: npm ERR! code ELIFECYCLE
Jan 2 19:44:38 ip-172-31-23-147 web: …Run Code Online (Sandbox Code Playgroud)