0

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

.ebextensions 容器命令.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

4

0 回答 0