vercel / next.js

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

When npm run dev, -4094 syscall: 'open' occurs intermittently. #60628

Open eeennsu opened 8 months ago

eeennsu commented 8 months ago

Link to the code that reproduces this issue

Operating System:
      Platform: win32
      Arch: x64
      Version: Windows 10 Pro
    Binaries:
      Node: 20.11.0
      npm: N/A
      Yarn: N/A
      pnpm: N/A
    Relevant packages:
      next: 14.0.5-canary.56
      react: ^18
      react-dom:  ^18
      typescript: ^5

https://github.com/eeennsu/nextjs-post2

To Reproduce

  1. npm run dev
  2. Develope my project
  3. error occur

Current vs. Expected behavior

[Error: UNKNOWN: unknown error, open 'D:\myCoding\GitHub\nextjs-post2\.next\static\chunks\app\layout.js'] {
  errno: -4094,
  code: 'UNKNOWN',
  syscall: 'open',
  path: 'D:\\myCoding\\GitHub\\nextjs-post2\\.next\\static\\chunks\\app\\layout.js'
}

While developing with npm run dev, the -4094 UNKOWN error occasionally occurs. I don't know the timing and conditions under which it occurs, and after Googling, it seems that the same error has already occurred before and it still hasn't been fixed.

What I did to fix this bug

  1. remove .next
  2. npm cache clean --force
  3. npm cache verify
  4. remove node_modules
  5. restart vscode
  6. computer format and reinstall all programs

I tried all the solutions but couldn't solve it. I hope this bug is resolved as soon as possible.

This error does not occur only in a specific project, but occurs simultaneously in all of my projects. So I think it is next.js's own error.

Verify canary release

Provide environment information

{
  "dependencies": {
    "@grafbase/sdk": "^0.14.0",
    "@headlessui/react": "^1.7.18",
    "@radix-ui/react-slot": "^1.0.2",
    "@types/jsonwebtoken": "^9.0.5",
    "class-variance-authority": "^0.7.0",
    "cloudinary": "^1.41.2",
    "clsx": "^2.1.0",
    "framer-motion": "^10.18.0",
    "graphql-request": "^6.1.0",
    "lucide-react": "^0.309.0",
    "mongoose": "^8.0.4",
    "next": "^14.0.4",
    "next-auth": "^4.24.5",
    "react": "^18",
    "react-dom": "^18",
    "react-hot-toast": "^2.4.1",
    "tailwind-merge": "^2.2.0",
    "tailwindcss-animate": "^1.0.7",
    "zustand": "^4.4.7"
  },
  "devDependencies": {
    "@grafbase/sdk": "~0.14.0",
    "@types/node": "^20",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "autoprefixer": "^10.0.1",
    "postcss": "^8",
    "tailwindcss": "^3.3.0",
    "typescript": "^5"
  },
  "name": "nextjs-post2-project",
  "private": true,
  "scripts": {
    "build": "next build",
    "dev": "next dev",
    "lint": "next lint",
    "start": "next start"
  },
  "version": "0.1.0"
}

Which area(s) are affected? (Select all that apply)

Not sure

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

No response

sam-hieken commented 7 months ago

Same issue, only tested in dev; if -4094 is actually a meaningful error code documented somewhere, I sure haven't been able to find it... Removing .next seemed to have no effect, my only solution so far is just restarting the server; a temporary fix unfortunately.

ObaidAshiq commented 6 months ago

Restarting server doesnt seem to do the job I tried this on 14.1.0 It happens there, so far i dont seem to find any fix

KennedyNvsf commented 6 months ago

any fix yet?

sam-hieken commented 6 months ago

Nope, apparently an issue completely crippling the development server isn't worth their time

thecil commented 6 months ago

I have also been getting the same error at the same path .next\static\chunks\app\layout.js when trying npm run dev, i realized when you call the localhost url, at least for me, it stuck at compiling /favicon.ico, keep in mind i have not modified the favicon, so im using the default one from the nextjs package.

I have not fixed it (cuz the error appears without any change on my files) but found a workaround:

Mun-cloud commented 6 months ago

I also had the same issue and an error occurred every time I moved the page in the dev environment, so I ran npm run dev again every time. However, I think it was resolved by running npm update. At least it hasn't happened yet, so I recommend giving it a try.

tomasohCHOM commented 5 months ago

Encountering this error as well. Seems to be happening if I try to save and recompile files too quickly. Can confirm that it happens in both Next 12 and Next 14 versions. I'm using Windows 11 as well, so it might be an issue at the OS level unfortunately...

sam-hieken commented 4 months ago

@Mun-cloud No luck for me when I tried updating, running Next 14.2.3 and still getting the error. I've been having some unrelated issues with my file system though, so it's possible that's the cause (although this still seems to be a pretty common issue)

ValdingLapukins commented 4 months ago

This issue solution helped me: https://github.com/vercel/next.js/discussions/60185#discussioncomment-9145585

Or you could also just delete Bitdefender and enable the windows antivirus settings and then relaunch your IDE and develop your project.