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

EEXIST: file already exists, symlink when build nextjs standalone mode twice #4663

Open
nhducit opened this issue May 4, 2022 · 9 comments

Comments

@nhducit
Copy link

nhducit commented May 4, 2022

pnpm version:

7.0.0

Code to reproduce the issue:

https://github.com/nhducit/pnpm-nextjs-standalone

Expected behavior:

build success

Actual behavior:

web:build: > Build error occurred
web:build: [Error: EEXIST: file already exists, symlink '../../../@next+env@12.1.6/node_modules/@next/env' -> '/Users/ducnguyen/Documents/code/pnpm-test/apps/web/node_modules/.pnpm/next@12.1.6_ef5jwxihqo6n7gxfmzogljlgcm/node_modules/@next/env'] {

Additional information:

  • node -v prints: v16.13.2
  • Windows, macOS, or Linux?: macOS 12.3.1
  • I'm not sure is this a pnpm or next.js bug.
@zkochan
Copy link
Member

zkochan commented May 4, 2022

It doesn't look related to pnpm. You run turbo which runs next. How is pnpm involved?

@await-ovo
Copy link
Member

I think setting experimental.outputFileTracingRoot should solve this problem.
https://nextjs.org/docs/advanced-features/output-file-tracing#caveats

@hugovntr
Copy link

Sorry to bump this issue, unfortunately it seems to be an issue with PNPM itself.

I use a similar setup than the one linked by @nhducit (2 nextjs apps and a packages folder) without turborepo and it does the same thing.
On a first compilation it all runs great, but fails afterwards.

The temporary fix that I found for it is rm -rf apps/MY_APP/node_modules/.pnpm/*. I assume this is not the proper way to do it, but it does the trick

@nhducit
Copy link
Author

nhducit commented May 31, 2022

Let me try repro with yarn

@mindyourlifeguide
Copy link

I confirm the issue. I have pnpm + next and it does not work when I rebuild it.

@mindyourlifeguide
Copy link

await-ovo workaround works.
Thanks, @await-ovo

@mindyourlifeguide
Copy link

Hastened to conclusions - the problem is not solved.

@kilemensi
Copy link

Ran into this issue on v7.3.0 but bumping to the recently released PNPM v7.4.0 and Next.js v12.2.0 appears to fix it @nhducit @hugovntr @mindyourlifeguide

@teddybee
Copy link

teddybee commented Mar 3, 2023

I still have this issue with pnpm 7.28 and nextjs 13.2.3 at the end of vercel build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants