The file does not exist at "node_modules/.vite/deps/chunk*" which is in the optimize deps directory.
#17738
Replies: 47 comments 31 replies
-
Just seemingly randomly started getting the same (with sveltekit). I already completely nuked and reinstalled |
Beta Was this translation helpful? Give feedback.
-
Clearing cache on the browser fixes it! Strange. Since I've never seen this before and it seems like there is a sudden influx of reports of this recently, I wonder if it's a regression on vite or some other common package. |
Beta Was this translation helpful? Give feedback.
-
Same here. This bug seems to happen when I use dynamic import on local development server. As workaround, I'm trying the 2 ways below. It's gonna happen soon again tho.
|
Beta Was this translation helpful? Give feedback.
-
Blowing away my node_modules and re-running |
Beta Was this translation helpful? Give feedback.
-
Same issue here, removing /node_modules/.vite and npm install solves it until next build or |
Beta Was this translation helpful? Give feedback.
-
Same issue here. Very annoying. |
Beta Was this translation helpful? Give feedback.
-
Has anyone stepped back versions to see when it started happening? |
Beta Was this translation helpful? Give feedback.
-
I'm facing the same problem, run |
Beta Was this translation helpful? Give feedback.
-
We are also running into this issue seemingly at random |
Beta Was this translation helpful? Give feedback.
-
Adding this to my vite config seems to help with the issue but, I'm sure I understand the full implications |
Beta Was this translation helpful? Give feedback.
-
I also faced the same problem. Vite says it can not find a dependency that is in another project! |
Beta Was this translation helpful? Give feedback.
-
Experiencing the same issue in my SvelteKit app. Resolved by clearing cache and node_modules. Thanks @efstajas |
Beta Was this translation helpful? Give feedback.
-
Same happening randomly when switching between branches with slightly different dependencies |
Beta Was this translation helpful? Give feedback.
-
Same issue here, it started after upgrading from Angular v17 to 18.2.0, which comes with a new version of Vite I guess. We work in a monorepo where there is a component library and an app project using the components. Whenever I create a new file that is exported, or change branches without said new files, the bug appears and the web app refuses to load. Can be temporarily fixed by clearing npm and angular cache, or by disabling caching in the browser. But the moment a file changes, the error comes back. |
Beta Was this translation helpful? Give feedback.
-
Same issue here. Just started randomly out of nowhere. Deleting node_modules/.vite fixes it for me until it rises again. UPD: So it happens mostly when I switch branches with different packages installed. Most of the time vite says:
|
Beta Was this translation helpful? Give feedback.
-
I guess it should be fixed in vite@6. See more info: #17336 and #18560 |
Beta Was this translation helpful? Give feedback.
-
I have also have this message when i ran my app on a local Ionic server with "ionic serve" and it crash. However when I ran it in production mode with "ionic serve --prod" it works . |
Beta Was this translation helpful? Give feedback.
-
We had a similar issue with the @neo4j-nvl. We tried all the suggested changes, and finally, this worked.
We tried other things, like disabling prebundling, but that didn't help. We are using nuxt 3.13 and the Vite version (5.4.2) bundled with it. EDIT: Adding info for the production build. |
Beta Was this translation helpful? Give feedback.
-
Please turn off browser Ad blockers like Ad Block, because they can also cause this problem, I'm not sure why, but turn them off and they won't happen |
Beta Was this translation helpful? Give feedback.
-
For me reinstalling the node_modules didn't work. I tried hard reload in my Chrome and it started. |
Beta Was this translation helpful? Give feedback.
-
Started seeing this issue a couple of days ago, went away after a rimraff of node modules, but came back after a few more repo changes in a project. |
Beta Was this translation helpful? Give feedback.
-
Browser cache clearing works. almost spent an hour switching node versions and reinstalling node modules. |
Beta Was this translation helpful? Give feedback.
-
I had the same error today. It was not working in Google Chrome, but in Firefox it was Ok. A simple force reload cache did it for me. |
Beta Was this translation helpful? Give feedback.
-
I am getting this on Firefox-nightly, it doesn't show up in normal firefox , opera, chrome, or even firefox-nightly that is installed in wsl.
|
Beta Was this translation helpful? Give feedback.
-
For me, it was a tricky caching issue. My setup involves a Cloudflare Zero Trust Tunnel to use my local dev server on a subdomain of main hosting. By default, this involves caching for files, which did eventually link to stale assets. So nothing vite is responsible for, yet the symptoms did lead to this issue. My solution is to disable the Cloudlfare's cache for my dev subdomain via a custom cache rule. |
Beta Was this translation helpful? Give feedback.
-
We're getting this on an Angular 18 project for a couple of weeks now. I am not sure what changed, definitely not our npm modules. We see it on Chrome and Edge on Linux. One way to get around it, as others have noted, is to disable the browser cache entirely from the network tab in the dev tools. Another way is to delete the I hope someone can sort this out. |
Beta Was this translation helpful? Give feedback.
-
I've been getting this when switching between branches of a Sveltekit project. Luckily the fix by @eudoroolivares2016 worked for me, but I'm not quite sure of the implications of this setting and of course it would be desirable if it worked out of the box. |
Beta Was this translation helpful? Give feedback.
-
This started happening to me, too. A few months ago, then it went away. Now it's back a couple of times every day. I'm not changing my config or toolchain/deps so It's unclear what the problem is. I use Chrome and Firefox with the same results. (Vite 5.4, svelte 5, sveltekit 2.5) |
Beta Was this translation helpful? Give feedback.
-
I had exactly this issue with Vite:
In my case, the error appeared after deleting some unused .js files from the project. I double-checked using PhpStorm to make sure there were no remaining imports, but Vite kept trying to load an optimized chunk that no longer existed. I tried all the usual fixes: Deleting node_modules Removing package-lock.json Manually deleting .vite/ Running npx vite --force None of that worked. Surprisingly, what actually solved it was a suggestion I found online: clearing the browser cache. I know it sounds unrelated—but it worked. Why? By clearing the browser cache, the browser stops requesting the outdated chunk, and Vite no longer complains. 💡 Conclusion: If you’re getting this error even after cleaning .vite, reinstalling your dependencies, and using --force, try clearing your browser cache. The problem might be on the client side, not in your build setup. (Thanks to ChatGPT for explaining this mess to me so clearly—it saved me a ton of time.) |
Beta Was this translation helpful? Give feedback.
-
I had the same problem — everything worked fine the first time, but from the second time onward, it broke. I resolved the issue by clearing the browser cache. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm getting the following message, sometimes, seemingly only after HMR happens a few times:
I haven't been able to find any cause, but as far as I can tell, it didn't result from adding any package, as I haven't done so in a while. It also doesn't happen always, and seemingly only starts happening after HMR, but not after every HMR (HMR as also been really slow)
There's a similar discussion in storybookjs/storybook#28542 but I'm not using storybook
Note: Since I haven't been able to create a minimal reproduction, I can't post this as a bug report
This makes some sense, but I have no idea how I would go about reducing this, tbh...
Beta Was this translation helpful? Give feedback.
All reactions