next.js icon indicating copy to clipboard operation
next.js copied to clipboard

code EPERM, path: ...\\trace

Open Felipe-Emanuel opened this issue 2 years ago • 6 comments

Verify canary release

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

Provide environment information

Operating System:
      Platform: win32
      Arch: x64
      Version: Windows 10 Home
    Binaries:
      Node: 18.13.0
      npm: N/A
      Yarn: N/A
      pnpm: N/A
    Relevant packages:
      next: 13.3.1-canary.16
      eslint-config-next: N/A
      react: 18.2.0
      react-dom: 18.2.0

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

No response

Link to the code that reproduces this issue

https://github.com/Felipe-Emanuel/Pablo-Studio

To Reproduce

npm run dev to run project and this api to get products mocked/api to freigth request and side by side run npm run build to get this problem in your screen

Describe the Bug

uncaughtException [Error: EPERM: operation not permitted, open <project path.next\trace>'] { errno: -4048, code: 'EPERM', syscall: 'open', path: 'F:\projeto-teste\.next\trace' }

Dev server should not be online while building, but building static page require API and my API's are running by next api...

to build an aplication is necessary to access file trace in .next. U can do it if are u in development, but (and u can check in your computer with prop trace file in .next folder) when run npm run build u will just lost your admin powers and cannot more access trace, so u can't do build

Expected Behavior

a normal comportament is a full build completelly or any tipcal error to be resolved, but this I don't know if is in my hand once time that I lost my admin power in trace

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

Yeah, but since this error, it's impossible deploying with build problems

Felipe-Emanuel avatar Apr 20 '23 17:04 Felipe-Emanuel

We're hitting this problem. We need to have a Husky task that runs Cypress e2e tests (which requires a dev instance running), and a build (which, as detailed above, does not work if a dev instance is running). So, currently, what we need to do is not possible.

AndrewIsh avatar Mar 28 '24 11:03 AndrewIsh

Estamos enfrentando esse problema. Precisamos ter uma tarefa Husky que execute testes Cypress e2e (que requer uma instância dev em execução) e uma compilação (que, conforme detalhado acima, não funciona se uma instância dev estiver em execução). Então, atualmente, o que precisamos fazer não é possível.

What I recommend to you is to set a error boundary in you aplication, maybe can be helpfull. By 3 days just looked for this problem and de root of the problem was a undefined prop trying a to do a map. I have no ideia why it happens, but, with luck, a error boundry can be util.

Sorry for haven't a fix

Felipe-Emanuel avatar Mar 28 '24 12:03 Felipe-Emanuel

What I recommend to you is to set a error boundary in you aplication, maybe can be helpfull. By 3 days just looked for this problem and de root of the problem was a undefined prop trying a to do a map. I have no ideia why it happens, but, with luck, a error boundry can be util.

Sorry for haven't a fix

Could you please elaborate on how an error boundary could help resolve this? As far as I can see, the problem is related to the running dev server accessing .next/trace and preventing the build process from accessing the same file.

AndrewIsh avatar Mar 28 '24 13:03 AndrewIsh

Is a idea based on how a friend of my work team solved this problem once that have investigated about the root problem.

Supposing u have made a investigation to find any possible root to this problem, you can try remove this file/route and try to build your project, then back with your problematic part of system, so then, with error boundary, should be easly to find how to fix and can build your project again.

Don't forget to remove .next and clear your cache

Felipe-Emanuel avatar Mar 28 '24 14:03 Felipe-Emanuel

You need to enable Windows Developer Mode - https://www.howtogeek.com/292914/what-is-developer-mode-in-windows-10/

This works for me 🫡

ivan2214 avatar Jun 09 '24 00:06 ivan2214

This issue has been automatically marked as stale due to inactivity. It will be closed in 7 days unless there’s further input. If you believe this issue is still relevant, please leave a comment or provide updated details. Thank you.

nextjs-bot avatar Dec 06 '25 23:12 nextjs-bot

This issue has been automatically closed due to inactivity. If you’re still experiencing a similar problem or have additional details to share, please open a new issue following our current issue template. Your updated report helps us investigate and address concerns more efficiently. Thank you for your understanding!

nextjs-bot avatar Dec 13 '25 23:12 nextjs-bot