如何将ElasticBeanstalk容器命令配置为.ebextensions

时间:2020-05-10 13:48:09

标签: reactjs amazon-elastic-beanstalk next.js ebextensions

我已将我的React SSR应用程序部署到ElasticBeanstalk,在运行npm start之前,应该有命令运行“ npm run-script build”以进行构建,但是不幸的是npm start正在运行,并且由于找不到代码而导致应用程序崩溃在服务器上,我设置了.ebextension以运行容器命令。

.ebextensions container-command.config

我的代码在这里

commands:
deploy:
  command: "npm run-script build"
  leader_only: true

命令未在我遇到错误的服务器上运行

错误:在'/var/app/current/.next'目录中找不到有效的版本!在启动服务器之前,尝试使用“下一个构建”构建您的应用程序。 在Server.readBuildId(/var/app/current/node_modules/next-server/dist/server/next-server.js:435:23) 在新服务器上(/var/app/current/node_modules/next-server/dist/server/next-server.js:44:29) 在module.exports(/var/app/current/node_modules/next-server/index.js:4:10) 在module.exports(/var/app/current/node_modules/next/dist/server/next.js:2:161) 在开始时(/var/app/current/node_modules/next/dist/server/lib/start-server.js:1:323) 在nextStart(/var/app/current/node_modules/next/dist/cli/next-start.js:22:125) 在/ var / app / current / node_modules / next / dist / bin / next:29:346

0 个答案:

没有答案