I was having issues today to build static nextjs landing page. This error below:
Error: Could not find a production build in the '/opt/render/project/src/.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
the docs refers to builds on nextj using
yarn ; yarn build ; yarn next export;
I changed to
yarn && yarn build && yarn next export;
Thanks for adding your find to the community and glad to hear you solved your issue.
However, it feels like there may have been some other issue at play here.
yarn; yarn build; yarn next export; will run each command whether the previous was successful or not.
yarn && yarn build && yarn next export; will only run the subsequent command if the previous was successful.
This implies something else may have been the cause of the shared error, as the individual commands are the same.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.