Skip to content
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

Error: ENOENT: no such file or directory, lstat '/app/.next/server/app' #44442

Closed
1 task done
khteh opened this issue Dec 30, 2022 · 3 comments · Fixed by #51993
Closed
1 task done

Error: ENOENT: no such file or directory, lstat '/app/.next/server/app' #44442

khteh opened this issue Dec 30, 2022 · 3 comments · Fixed by #51993
Labels
bug Issue was opened via the bug report template. locked

Comments

@khteh
Copy link

khteh commented Dec 30, 2022

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

"next": "13.1.1",

Which area(s) of Next.js are affected? (leave empty if unsure)

No response

Link to the code that reproduces this issue

private repo

To Reproduce

$ yarn install
$ yarn build

Describe the Bug

> Build error occurred
[Error: ENOENT: no such file or directory, lstat '/root/workspace/apps/api/.next/server/app'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'lstat',
  path: '/root/workspace/apps/api/.next/server/app'
}

Expected Behavior

No build error

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

@khteh khteh added the bug Issue was opened via the bug report template. label Dec 30, 2022
@lienista
Copy link

lienista commented Jan 2, 2023

I'm hitting similar issue after upgrading to Node v18. File path works locally but on Vercel, it's unable to find the file.

@phunanon
Copy link

phunanon commented May 17, 2023

I'm having the same issue on 13.4.2. A workaround is to, after the .next directory has been emptied, create an empty server/app directory by the time that it is required in the build process. This workaround was mentioned in this issue: #44120

@kodiakhq kodiakhq bot closed this as completed in #51993 Jul 10, 2023
kodiakhq bot pushed a commit that referenced this issue Jul 10, 2023
…re is no `app/` page (#51993)

### What?
This PR fixes build crashing when `output: 'standalone'` and `experimental.appDir` is enabled but there is no app pages.

### How?
It does that by checking whether `.next/server/app` exists before copying the folder to `.next/standalone/...`

Closes #51828
Fixes #44442
Fixes #44120
@github-actions
Copy link
Contributor

github-actions bot commented Aug 9, 2023

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot added the locked label Aug 9, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. locked
Projects
None yet
3 participants