Error: Could not find a production build in the '/home/ubuntu/cal.com/apps/web/.next', works on yarn dev
Found a bug? Please fill out the sections below. 👍
Issue Summary
A summary of the issue. This needs to be a clear detailed-rich summary.
Steps to Reproduce
- Self hosted install of latest build
- yarn and yarn build
- yarn dev works fine
- yarn start - gives the below error and exits
Error: Could not find a production build in the '/home/ubuntu/cal.com/apps/web/.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id @calcom/web:start: at NextNodeServer.getBuildId (/home/ubuntu/cal.com/node_modules/next/dist/server/next-server.js:116:23) @calcom/web:start: at new Server (/home/ubuntu/cal.com/node_modules/next/dist/server/base-server.js:70:29) @calcom/web:start: at new NextNodeServer (/home/ubuntu/cal.com/node_modules/next/dist/server/next-server.js:63:9) @calcom/web:start: at NextServer.createServer (/home/ubuntu/cal.com/node_modules/next/dist/server/next.js:140:16) @calcom/web:start: at async /home/ubuntu/cal.com/node_modules/next/dist/server/next.js:149:31 @calcom/web:start: error Command failed with exit code 1. @calcom/web:start: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. @calcom/web:start: ERROR: command finished with error: command (apps/web) yarn run start exited (1) command (apps/web) yarn run start exited (1)
I think this happens due to the order. yarn build (also make sure this succeeds) builds the repo, but yarn dev clears out the .next folder. So if you run yarn dev after building it clears out your build.
try yarn build && yarn start?
try
yarn build && yarn start?
Will give this a try and let you know. But when i did this previously using the order you suggest, i got TypeError: Cannot use 'in' operator to search for 'viewer.public.i18n' in undefined and hence why i tried the dev option and noticed it worked find with dev and only failed when building production
Update:
Exact same issue with your sequence
@calcom/web:start: Error: Could not find a production build in the '/home/ubuntu /cal.com/apps/web/.next' directory. Try building your app with 'next build' befo re starting the production server. https://nextjs.org/docs/messages/production-s tart-no-build-id @calcom/web:start: at NextNodeServer.getBuildId (/home/ubuntu/cal.com/node_m odules/next/dist/server/next-server.js:116:23) @calcom/web:start: at new Server (/home/ubuntu/cal.com/node_modules/next/dis t/server/base-server.js:70:29) @calcom/web:start: at new NextNodeServer (/home/ubuntu/cal.com/node_modules/ next/dist/server/next-server.js:63:9) @calcom/web:start: at NextServer.createServer (/home/ubuntu/cal.com/node_mod ules/next/dist/server/next.js:140:16) @calcom/web:start: at async /home/ubuntu/cal.com/node_modules/next/dist/serv er/next.js:149:31 @calcom/web:start: error Command failed with exit code 1. @calcom/web:start: info Visit https://yarnpkg.com/en/docs/cli/run for documentat ion about this command. @calcom/web:start: ERROR: command finished with error: command (apps/web) yarn r un start exited (1) command (apps/web) yarn run start exited (1)
Tasks: 1 successful, 2 total Cached: 0 cached, 2 total Time: 3.684s
error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this comm and.
Builds and says succesful, but when using yarn start it fails as above.
Experiencing the same issue with the latest release.Any idea on how to fix this. Thanks.
This worked out for me https://github.com/calcom/cal.com/discussions/3821
Sorry, but does anyone know what was in that discussion page? Running into the same issue :)
I am not sure if this is what solved it for me, but I updated apps/web/next.config.js to have
module.exports = {
typescript: {
// !! WARN !!
// Dangerously allow production builds to successfully complete even if
// your project has type errors.
// !! WARN !!
ignoreBuildErrors: true,
},
}
https://nextjs.org/docs/pages/api-reference/next-config-js/typescript
I read somewhere that you just need to ignore type errors.