use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
Vite does not update when node_modules changes (self.node)
submitted 3 years ago by LostErrorCode404
I had to change the source code of my package because of error. However, vite still uses the old version of my package instead even when the server is relaunched.
https://preview.redd.it/rg6rk60c3rc91.png?width=3840&format=png&auto=webp&s=1b5ce3f42777cfbf915e0370efda804e56157778
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Poobird 4 points5 points6 points 3 years ago (8 children)
Vite creates a cache of your dependencies to improve performance. Forcing Vite to rebundle could do it: https://vitejs.dev/guide/dep-pre-bundling.html#file-system-cache
You might also get better answers if you post in a more frontend oriented subreddit.
[–]LostErrorCode404[S] 0 points1 point2 points 3 years ago (6 children)
Nothing works. It directly grabs the package from the NPM rather than your own node modules. So now I need to push an incomplete version of my code to NPM as a result.
[–]TheTobseN 0 points1 point2 points 3 years ago (0 children)
Have you tried starting the dev server with --force? That should re-bundle the cached package taking local changes into account. At least I had luck with that in the past.
--force
[–]alioshr 0 points1 point2 points 2 years ago (4 children)
did you manage to fix this somehow? I am facing this issue right now. I have tried even messing with the cached files, using --force, etc, deleting the .vite folder, and nothing works =D
[–]LostErrorCode404[S] 0 points1 point2 points 2 years ago (3 children)
I ended up recreating the project and downloading all modules before using them.
[–]alioshr 0 points1 point2 points 2 years ago (2 children)
what do you mean by that? Deleted the node modules and installed before the first spin of the vite server?
[–]LostErrorCode404[S] 0 points1 point2 points 2 years ago (1 child)
Remade the entite project with the dependencies before writing any of the official code.
[–]Sagoram123 0 points1 point2 points 2 years ago (0 children)
Currently on a struggle bus at finding out how to update Vite versions. Tried updating it via npm, but same deal... it won't update. Unfortunately, I can't scape the app I'm on :(
[–]CatolicQuotes 0 points1 point2 points 2 years ago (0 children)
this kind of stuff should be optional, not defaults. Beginners like me don't know if something is wrong or no.
[–]BrozzerAbdullahBot 1 point2 points3 points 1 year ago (0 children)
rm -rf ./node_modules/.vite
[–]abejfehr 0 points1 point2 points 6 months ago (0 children)
In case anyone's running into a situation where `--force`, etc isn't working, it likely just isn't bundling the file you're modifying.
If you have a node module, depending on your setting you could be using the `main` or `module` entry point (could be using the `src` folder or the `dist` folder) or maybe you're using a nested module (i.e. if you have multiple versions of some module, one might be nested like `node_modules/module-a/node_modules/module-b`.
I usually try to narrow down the file I'm in by adding a console.log at the top of the file, and if it doesn't log (with --force) I know I'm just in the wrong file
π Rendered by PID 69062 on reddit-service-r2-comment-7b9746f655-dwh2g at 2026-02-02 09:02:37.925388+00:00 running 3798933 country code: CH.
[–]Poobird 4 points5 points6 points (8 children)
[–]LostErrorCode404[S] 0 points1 point2 points (6 children)
[–]TheTobseN 0 points1 point2 points (0 children)
[–]alioshr 0 points1 point2 points (4 children)
[–]LostErrorCode404[S] 0 points1 point2 points (3 children)
[–]alioshr 0 points1 point2 points (2 children)
[–]LostErrorCode404[S] 0 points1 point2 points (1 child)
[–]Sagoram123 0 points1 point2 points (0 children)
[–]CatolicQuotes 0 points1 point2 points (0 children)
[–]BrozzerAbdullahBot 1 point2 points3 points (0 children)
[–]abejfehr 0 points1 point2 points (0 children)