I have deployed my react SSR app to ElasticBeanstalk, before running npm start there should be command to run "npm run-script build" to make a build, but unfortunately npm start is running and app crashes due to no code build found on server, I setup .ebextension to run container command.
.ebextensions container-command.config
here my code is
commands:
deploy:
command: "npm run-script build"
leader_only: true
command is not running on server I am facing error
Error: Could not find a valid build in the '/var/app/current/.next' directory! Try building your app with 'next build' before starting the server. at Server.readBuildId (/var/app/current/node_modules/next-server/dist/server/next-server.js:435:23) at new Server (/var/app/current/node_modules/next-server/dist/server/next-server.js:44:29) at module.exports (/var/app/current/node_modules/next-server/index.js:4:10) at module.exports (/var/app/current/node_modules/next/dist/server/next.js:2:161) at start (/var/app/current/node_modules/next/dist/server/lib/start-server.js:1:323) at nextStart (/var/app/current/node_modules/next/dist/cli/next-start.js:22:125) at /var/app/current/node_modules/next/dist/bin/next:29:346