cal.diy icon indicating copy to clipboard operation
cal.diy copied to clipboard

Error: Could not find a production build in the '/home/ubuntu/cal.com/apps/web/.next', works on yarn dev

Open CodingRockz opened this issue 4 years ago • 7 comments

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

  1. Self hosted install of latest build
  2. yarn and yarn build
  3. yarn dev works fine
  4. 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)

CodingRockz avatar Oct 11 '22 11:10 CodingRockz

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?

emrysal avatar Oct 11 '22 16:10 emrysal

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

CodingRockz avatar Oct 12 '22 03:10 CodingRockz

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.

CodingRockz avatar Oct 12 '22 03:10 CodingRockz

Experiencing the same issue with the latest release.Any idea on how to fix this. Thanks.

Denniskamau avatar Nov 02 '22 12:11 Denniskamau

This worked out for me https://github.com/calcom/cal.com/discussions/3821

Denniskamau avatar Nov 02 '22 15:11 Denniskamau

Sorry, but does anyone know what was in that discussion page? Running into the same issue :)

CoffeeFlux avatar Jul 18 '23 19:07 CoffeeFlux

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.

carlosrojas avatar Aug 02 '23 20:08 carlosrojas