Skip to content

Clear up error message when production build is missing during next export #19788

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
timneutkens opened this issue Dec 3, 2020 · 1 comment · Fixed by #19777
Closed

Clear up error message when production build is missing during next export #19788

timneutkens opened this issue Dec 3, 2020 · 1 comment · Fixed by #19777
Assignees
Milestone

Comments

@timneutkens
Copy link
Member

timneutkens commented Dec 3, 2020

From @jlongster:

Problem #3: static export

I ran:

$ next export

I got this error:

Error: ENOENT: no such file or directory, open '/Users/james/tmp/devii/.next/BUILD_ID'
    at Object.openSync (fs.js:440:3)
    at readFileSync (fs.js:342:35)
    at exportApp (/Users/james/tmp/devii/node_modules/next/dist/export/index.js:2:919) {

Again you need to do next build first. Not clear at all.

When the export finally worked I got this output:

info  - using build directory: /Users/james/tmp/devii/.next
info  - Copying "static build" directory
info  - No "exportPathMap" found in "next.config.js". Generating map from "./pages"
info  - Launching 7 workers
info  - Copying "public" directory
info  - undefined (2/2)
Export successful

It doesn't tell me where it put the static export, and the undefined is off-putting (tweet). Turns out it puts it in the out folder


Notes from me:

Had a look at this and it turns out there's an edge case where it would throw this error when there is a .next folder but no production build (BUILD_ID missing).

The undefined part has been solved already in the latest version of Next.js (as replied on the tweet too).

The location not being available can be easily fixed 👍 Added it to #19777 as well

@timneutkens timneutkens added this to the iteration 14 milestone Dec 3, 2020
@Timer Timer modified the milestone: iteration 14 Dec 3, 2020
@kodiakhq kodiakhq bot closed this as completed in #19777 Dec 8, 2020
@Timer Timer added this to the iteration 14 milestone Dec 8, 2020
kodiakhq bot pushed a commit that referenced this issue Dec 8, 2020
…export` (#19777)

Adds an err.sh link to the production build missing message. Also clears up `valid` as `production`.

Also fixes an edge case where an unhelpful error would be thrown because we checked for `.next` instead of `.next/BUILD_ID`

Added the out directory location as the list line during export to make sure people know where the files are output. 

Fixes #19778
Fixes #19788
@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants