vercel / next.js

The React Framework
https://nextjs.org
MIT License
125.02k stars 26.7k forks source link

code EPERM, path: ...\\trace #48643

Open Felipe-Emanuel opened 1 year ago

Felipe-Emanuel commented 1 year ago

Verify 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

AndrewIsh commented 5 months ago

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.

Felipe-Emanuel commented 5 months ago

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

AndrewIsh commented 5 months ago

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.

Felipe-Emanuel commented 5 months ago

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

ivan2214 commented 3 months ago

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

This works for me 🫡