-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
-
Every so often, I get some HTTP 504 after starting up Vite. By killing Vite and restarting (sometimes 2-3 times), the error goes away. No changes in package.json, lock files or anything. It is always the same packages. Anything that could explain this behavior? It is livable, but also quite annoying for the entire team. Have been seeing this for the last 8 months.
Has been going on since Vite 2.6. Now on 2.9.1
Packages: tcomb, day.js
Beta Was this translation helpful? Give feedback.
All reactions
-
👀 5
Replies: 11 comments 18 replies
-
This command fixes it for me node ./node_modules/esbuild/install.js. Found the command on this thread #1361 (comment)
Not sure why its occurring or how to fix it permanently. Im on npm version 6.14.16
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 14 -
❤️ 3
-
YOU SAVED MY LIFE
Thanks
Beta Was this translation helpful? Give feedback.
All reactions
-
that's one of the many things that is trigged when just doing npm rebuild btw.
Beta Was this translation helpful? Give feedback.
All reactions
-
Still getting this on Vite 4 😢
image
Beta Was this translation helpful? Give feedback.
All reactions
-
Deleting all my node_modules and reinstalling them, with yarn in my case, worked for me!
Beta Was this translation helpful? Give feedback.
All reactions
-
The esbuild command mentioned above fixes the issue and is way faster than reinstalling all modules, so you should check it out. I just revisited my own thread to mention the fact that this still is an issue in Vite, two major versions later.
It is obviously related to esbuild somehow, but I remember digging into Vite internals earlier to figure out some other issue and it really burns some hours each time, so will wait this one out for now :)
Beta Was this translation helpful? Give feedback.
All reactions
-
i don't have esbuild installed in my project, running the above node command don't do anything and gives not found error.
Beta Was this translation helpful? Give feedback.
All reactions
-
I'm using Vite 4.2, npm 8.11 and Opera as the browser. If I go incognito or just use another browser I don't get the error. I have to reinstall node_modules every time I restart Vite. The node ./node_modules/esbuild/install.js command doesn't work for me. I tried clearing the site data in Opera but no success.
Beta Was this translation helpful? Give feedback.
All reactions
-
I happened for me again now, but changing browser and trying "private browsing" did not work, still got the same errors everywhere. For me, it works to just start vite again, I don't need to reinstall or remove any node_modules directory.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
Had the same issue on Vite 4.1.4 today. Adding optimizeDeps.force: true to my config seems to fix it, but that's not a great long term solution
Beta Was this translation helpful? Give feedback.
All reactions
-
In my case I tried to delete all data related to the website, no success, but after a couple of days the error stopped appearing. So for me it must have been the cache or something related entirely to the browser memory data.
Beta Was this translation helpful? Give feedback.
All reactions
-
@Dyoma3 Did you try the npm rebuild fix mentioned?
Beta Was this translation helpful? Give feedback.
All reactions
-
No, I didn't. For me, the issue just suddenly disappeared.
Beta Was this translation helpful? Give feedback.
All reactions
-
It seems to mostly happen when switching between branches. This could possibly affect the dependencies, but I am not sure if it is. In any case, most such issues seem to go away by running npm rebuild. This invokes the esbuild command mentioned by me above (amongst other things) and is much easier to get right, as that does not work the same if you use Yarn or PNPM.
Beta Was this translation helpful? Give feedback.
All reactions
-
Add the dependency like this to vite.config:
const optimizeDeps: DepOptimizationOptions = { include: ['@react-pdf/renderer'], };
Beta Was this translation helpful? Give feedback.
All reactions
-
Tjena. How is this a general answer? Could you explain how you think that works, as most people do not have that dependency.
Beta Was this translation helpful? Give feedback.
All reactions
-
This seems to be happening more often when two Vite processes are running at the same time, at least when the two are processing some of the same source code. (I actually wasn't able to reproduce the problem in our codebase when only running one of our two Vite instances, @fatso83 and @hcf ).
Beta Was this translation helpful? Give feedback.
All reactions
-
👀 2
-
This appears to be the case for me as well. Never get this just running one Vite process. Not sure what a reliable solution would be however.
Beta Was this translation helpful? Give feedback.
All reactions
-
Hey, I was actually facing this 504 error where my site was showing a blank screen. As I am new to web dev and digital ocean platform, I have had no idea of how to fix the error. But I fixed it for my problem as my site is static and I was trying to deploy it as a web service. So changing the type to 'static website' fixed my issue. Thought of adding an answer and to thank you for providing the idea of the kinds of error and solutions.
Thank You,
Beta Was this translation helpful? Give feedback.
All reactions
-
For me it helped to clear the file system cache by running rm -rf node_modules/.vite and then restarting the dev-server.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 6 -
🚀 6
-
Did you try npm rebuild by any chance? Wondering if this is just implicitly handled.
Beta Was this translation helpful? Give feedback.
All reactions
-
Before 5 this helps but still happens in vite 5
Beta Was this translation helpful? Give feedback.
All reactions
-
@fatso83 what rebuild are you talking about? what is the actual command of that npm script? Bare vite project does not have rebuild script
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
@deathemperor That is the actual command. Hence the syntax highlighting - try it before asking next time ;) This has nothing to do with Vite. It is a basic NPM lifecycle script that has to do with the installation of packages. See https://docs.npmjs.com/cli/v6/commands/npm-rebuild for more info.
It will ensure that packages that have build steps like gyp packages are being built properly for your current Node version.
Beta Was this translation helpful? Give feedback.
All reactions
-
Found out that browser's hard reload (Cmd+Shift+R on Mac) helps.
Beta Was this translation helpful? Give feedback.
All reactions
-
👎 1 -
❤️ 1 -
🚀 3
-
This is still an issue in Vite 5.4.3
Beta Was this translation helpful? Give feedback.
All reactions
-
Do you have multiple Vite processes running, by any chance? That was the case for us. We could never reproduce this with a single Vite process running.
Beta Was this translation helpful? Give feedback.
All reactions
-
Still an issue in Vite 7.1.10, and only for one user...
Beta Was this translation helpful? Give feedback.