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

output: 'standalone' error: ENOENT: no such file or directory, lstat .next/server/app #44120

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

output: 'standalone' error: ENOENT: no such file or directory, lstat .next/server/app #44120

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

Comments

@khteh
Copy link

khteh commented Dec 18, 2022

Verify canary release

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

Provide environment information

"next": "13.0.6",

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

Buildind a output: 'standalone' application bumps into the following build error:

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

Describe the Bug

Building a output: 'standalone' application bumps into the following build error:

       > Build error occurred
       [Error: ENOENT: no such file or directory, lstat '/apps/api/.next/server/app'] {
         errno: -2,
         code: 'ENOENT',
         syscall: 'lstat',
         path: '/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 18, 2022
@DuCanhGH
Copy link
Contributor

Can you make a minimal reproduction? It's not like you have to link to your actual repo as using actual repos makes it hard to find the issue anyway. This doesn't seem to be happening to me...

@baronha
Copy link

baronha commented Dec 23, 2022

I have the same issue

@ovasylenko
Copy link

ovasylenko commented Dec 25, 2022

Temporary hotfix

"build": "next build; bash -c 'sleep 10 && mkdir -p ./.next/server/app'"

It creates an app folder. The issue that builds does not create a folder .next/server/app if created during the build - build passes with no issues.

It is not a solid solution. Just a temporary workaround for everyone stuck

@khteh
Copy link
Author

khteh commented Dec 26, 2022

Temporary hotfix

"build": "next build; bash -c 'sleep 10 && mkdir -p ./.next/server/app'"

It creates an app folder. The issue that builds does not create a folder .next/server/app if created during the build - build passes with no issues.

It is not a solid solution. Just a temporary workaround for everyone stuck

How about removing appDir: true from the experimental section of the file?

@ricardobrandao
Copy link

Hi,

Same issue occurring here and it only breaks when the appDir: true flag is on. This started happening at least on next@13.0.7 but is working fine on next@13.0.4

@BoBoooooo
Copy link

any solutions ?

@castrix
Copy link

castrix commented May 17, 2023

it's happening on 13.4.2 as well.

I'm not using appDir flag. here is my next.config.js:

module.exports = {
  output: 'standalone',
};

@nipunahh
Copy link

nipunahh commented May 25, 2023

Any solutions for this?

UPDATE:
Fixed by commenting out output:"standalone" and setting appDir: true

const nextConfig = {
    reactStrictMode: true,
    // output: 'standalone',
    swcMinify: false,
    experimental: {
        appDir: true,
}
}

@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
8 participants