I’m having trouble with my Laravel setup using Vite and Tailwind. Every time I run npm run dev, I get this annoying error message:
Error: The service was stopped at node_modules\esbuild\lib\main.js:947:34
After that, it shows:
Failed to scan for dependencies from entries: resources/js/app.js The service is no longer running
This happens even when I start a brand new Laravel project, so I think it’s something with esbuild on Windows.
Things I already tried:
- Removed node_modules folder and package-lock.json
- Reinstalled packages with different flags
- Cleared npm cache completely
- Turned off Windows Defender and antivirus
- Used both PowerShell and Git Bash as admin
- Created fresh Laravel project (same issue)
- Tried WSL but got installation errors
What should happen:
The Vite dev server should start normally so I can work on my project. Has anyone else run into this on Windows?
Check if your project path has spaces or special characters - esbuild hates those on Windows. Try running npm run dev -- --host instead, the default binding sometimes causes issues. Had the same problem last month and moving my project to C:\dev\ (shorter path) fixed it. Weird but worth trying.
I dealt with this exact error for weeks on Windows 11 with Laravel projects. Turned out to be Node.js version issues with esbuild. I was running Node 19.x and it kept crashing during dependency scanning. Downgraded to Node 18.17.0 LTS and it fixed everything. Also check if Windows Search Indexer is scanning your node_modules folder - that screwed me over too. You can exclude your project folder from indexing in Control Panel. Running cmd as admin helped, and make sure no other dev servers are using similar ports. esbuild’s way more finicky on Windows than Unix systems.
This happens when esbuild gets killed during dependency scanning. I’ve hit this on Windows 10 with Laravel projects. Try running npm run dev --force first - that usually gets around it temporarily. If that doesn’t work, bump up Node’s memory limit with NODE_OPTIONS=--max-old-space-size=4096 before running the command. Windows tends to kill esbuild when it eats too much memory scanning large dependency trees. Also check if VS Code extensions or other dev tools are auto-scanning files - they can mess with esbuild’s file watching. Close your editor and run the command in a fresh terminal to rule that out.