I consistently get this error when running my npm dev environment. I'm using visual studio code.
I have to run npm install every time to get it working again. and it works for a while then throws the error again.
[vite:dev ] Re-optimizing dependencies because lockfile has changed
[vite:dev ]
[vite:dev ] VITE v5.1.6 ready in 274 ms
[vite:dev ]
[vite:dev ] ➜ Local: http://localhost:5173/
[vite:dev ] ➜ press h + enter to show help
[vite:dev ] node:events:496
[vite:dev ] throw er; // Unhandled 'error' event
[vite:dev ] ^
[vite:dev ]
[vite:dev ] Error: EBUSY: resource busy or locked, lstat 'C:\DumpStack.log.tmp'
[vite:dev ] Emitted 'error' event on FSWatcher instance at:
[vite:dev ] at FSWatcher._handleError (file:///C:/Users/lee/Documents/GitHub/Template-Repository/node_modules/vite/dist/node/chunks/dep-jvB8WLp9.js:45867:10)
[vite:dev ] at NodeFsHandler._boundHandleError (file:///C:/Users/lee/Documents/GitHub/Template-Repository/node_modules/vite/dist/node/chunks/dep-jvB8WLp9.js:44340:43)
[vite:dev ] at ReaddirpStream.emit (node:events:518:28)
[vite:dev ] at emitErrorNT (node:internal/streams/destroy:169:8)
[vite:dev ] at emitErrorCloseNT (node:internal/streams/destroy:128:3)
[vite:dev ] at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
[vite:dev ] errno: -4082,
[vite:dev ] code: 'EBUSY',
[vite:dev ] syscall: 'lstat',
[vite:dev ] path: 'C:\\DumpStack.log.tmp'
[vite:dev ] }
[vite:dev ]
[vite:dev ] Node.js v20.11.1
ERROR: "vite:dev" exited with 1.
I have tried deleting node_modules and package-lock.json but still no consistent solution.
My Package.json file is
{
"scripts": {
"dev": "npm-run-all -p -l -r vite:dev shopify:dev",
"build": "npm-run-all -p -l -r vite:build",
"shopify:dev": "shopify theme dev --port 9000 --store fa0f41.myshopify.com --live-reload full-page",
"shopify:logout": "shopify auth logout",
"vite:dev": "vite dev",
"vite:build": "vite build",
"kill": "Taskkill /IM node.exe /F"
},
"type": "module",
"devDependencies": {
"@shopify/cli": "^3.57.0",
"@shopify/theme": "^3.57.0",
"autoprefixer": "^10.4.17",
"npm-run-all": "^4.1.5",
"postcss": "^8.4.35",
"tailwindcss": "^3.4.1",
"vite": "^5.0.12",
"vite-plugin-page-reload": "^0.2.0",
"vite-plugin-shopify": "^3.0.1"
}
}
the code throws error because there is possibility to having some permission issue or concurrency issue.
to solve this kind of issue make sure no other things or processes lock the file and also check the permission of file. and restart the app or system to release the locked resources.