Vite.js v2 occasionally crashes during development on Windows 10

See original GitHub issue

⚠️ IMPORTANT ⚠️ Please check the following list before proceeding. If you ignore this issue template, your issue will be directly closed.

  • Read the docs.
  • Use Vite >=2.0. (1.x is no longer supported)
  • If the issue is related to 1.x -> 2.0 upgrade, read the Migration Guide first.

Describe the bug

A clear and concise description of what the bug is.

My react project is created by yarn create @vitejs/app <repo-name> --template react-ts. When I start vite command yarn dev and save files it shows this error and stops vite runtime (it crashes sometimes sooner sometimes later):

15:53:57 [vite] hmr update /src/App.tsx
node:events:353
      throw er; // Unhandled 'error' event
      ^

Error: EBUSY: resource busy or locked, lstat 'C:\DumpStack.log.tmp'
Emitted 'error' event on FSWatcher instance at:
    at FSWatcher._handleError (C:\Users\bransky\projects\_playground\vitejs-issue-watcher-reproduction\node_modules\vite\dist\node\chunks\dep-055fc131.js:11574:10)
    at ReaddirpStream.NodeFsHandler._boundHandleError (C:\Users\bransky\projects\_playground\vitejs-issue-watcher-reproduction\node_modules\vite\dist\node\chunks\dep-055fc131.js:10070:43)
    at ReaddirpStream.emit (node:events:376:20)
    at emitErrorNT (node:internal/streams/destroy:188:8)
    at emitErrorCloseNT (node:internal/streams/destroy:153:3)
    at processTicksAndRejections (node:internal/process/task_queues:80:21) {
  errno: -4082,
  code: 'EBUSY',
  syscall: 'lstat',
  path: 'C:\\DumpStack.log.tmp'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Reproduction

Please provide a link to a repo that can reproduce the problem you ran into. A reproduction is required unless you are absolutely sure that the the problem is obvious and the information you provided is enough for us to understand what the problem is. If a report has only vague description (e.g. just a generic error message) and has no reproduction, it will be closed immediately.

https://github.com/MatejBransky/vitejs-issue-watcher-reproduction (it’s the unchanged project right after the command yarn create @vitejs/app <repo> --template react-ts)

I think it’s related to some background services which run e.g. during VS Code session because if I try to reproduce it within external terminal and project is not opened in VS Code then it’s still working…but when I try to open project with VS Code then sometimes(!) it crashes.

VS Code version: 1.52.1

System Info

  • vite version: 2.0.0-beta.48 (I had the issue already in v 2.0.0-beta.12)
  • Operating System: Windows 10 Pro (19042.746)
  • Node version: 15.4.0
  • Package manager (npm/yarn/pnpm) and version: yarn v1.22.5

Logs (Optional if provided reproduction)

  1. Run vite or vite build with the --debug flag.
  2. Provide the error log here.
16:41:27 [vite] hmr update /src/App.css (x2)
  vite:load 1ms   [fs] /src/App.css +2s
  vite:hmr [self-accepts] src\App.css +7ms
  vite:transform 0ms   /src/App.css +2s
  vite:time 3ms   /src/App.css?import& +2s
  vite:load 3ms   [fs] /src/App.css +2ms
  vite:hmr [self-accepts] src\App.css +2ms
  vite:transform 1ms   /src/App.css +2ms
  vite:time 4ms   /src/App.css?import& +2ms
node:events:353
      throw er; // Unhandled 'error' event
      ^

Error: EBUSY: resource busy or locked, lstat 'C:\DumpStack.log.tmp'
Emitted 'error' event on FSWatcher instance at:
    at FSWatcher._handleError (C:\Users\bransky\projects\_playground\vitejs-issue-watcher-reproduction\node_modules\vit
e\dist\node\chunks\dep-382a279c.js:11575:10)
    at ReaddirpStream.NodeFsHandler._boundHandleError (C:\Users\bransky\projects\_playground\vitejs-issue-watcher-repro
duction\node_modules\vite\dist\node\chunks\dep-382a279c.js:10071:43)
    at ReaddirpStream.emit (node:events:376:20)
    at emitErrorNT (node:internal/streams/destroy:188:8)
    at emitErrorCloseNT (node:internal/streams/destroy:153:3)
    at processTicksAndRejections (node:internal/process/task_queues:80:21) {
  errno: -4082,
  code: 'EBUSY',
  syscall: 'lstat',
  path: 'C:\\DumpStack.log.tmp'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

(I started yarn dev --debug at cca 16:35, last change was done at 16:41:27 and it crashed at 16:42:10 so it’s not related to the last change in the source code)

cc @Korn704 @zjhken

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
yyx990803commented, Jan 25, 2021

Good to know the blind guess fix worked! 😅

2reactions
sibbngcommented, Jan 25, 2021

I saw that error a lot while working on a Vite app last week. But it was really random.

After reading Evan’s comment, I found a reproduction.

Simply creating a new folder on C:\ directory fires this error.

I can reproduce in v2.0.0-beta.48. v2.0.0-beta.49 works fine ✌

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting - Vite
Vite cannot handle and does not support code that only runs on non-strict mode (sloppy mode). This is because Vite uses ESM and...
Read more >
How do I fix snipping tool randomly causing freezing and ...
1 SSD, 1 HDD, 1 M.2. Issue: Overall I've been noticing some issues when using the "Snipping Tool" where it will randomly freeze...
Read more >
Vue.js Vite app works in development but crashes after building
I have built a website using vite and vue.js. When I run npm run dev, everything works fine. I built the app with...
Read more >
Investigating memory access crashes - Apple Developer
Identify crashes that arise from memory access issues, and investigate the cause of the crash.
Read more >
Laravel Vite Issue - Laracasts
My application is using Inertia.js, and I've followed the migration guide from Laravel ... vite v2.9.13 dev server running at: Local: http://localhost:5173/ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found