Platform

Vite fixes

Vite build and env-var issues that appear on the host, not on your laptop.

6 fixes, most common first.

  1. Rank 3. Environment variables are undefined in production

    Works locally but env vars are undefined once deployed? Add them to your host, use the VITE_ or NEXT_PUBLIC_ prefix for browser code, then redeploy.

  2. Rank 10. Vercel 404: NOT_FOUND when refreshing a page or opening a direct link

    Home page works on Vercel but refreshing /dashboard gives 404 NOT_FOUND? Add a rewrite to index.html for your single-page app.

  3. Rank 11. Netlify "Page not found" when refreshing or opening a link

    Netlify shows "Page not found" on refresh or deep links? Add the /* /index.html 200 rewrite so your single-page app handles routing.

  4. Rank 12. Module not found: Can't resolve (build works locally, fails on Vercel)

    Vercel build fails with "Module not found: Can't resolve" but works on your Mac/PC? Usually filename casing. How to find and fix it.

  5. Rank 13. Changed an environment variable on Vercel but the live site still uses the old value

    Updated a key in Vercel env vars but nothing changed? Env var changes only apply to new deployments. Redeploy and check the right environment.

  6. Rank 37. Vite env var is undefined because the name has no VITE_ prefix

    import.meta.env.MY_KEY is undefined in a Vite app? Vite only exposes names that start with VITE_. Rename it and rebuild.

All platforms

Can't fix it? Get help.

If the steps didn't clear the error, send what the screen says. A person can take a look. This is a request for a paid fix, not an instant chat.

Request a fix