# Vite dev server keeps a failed import after you install the missing package: restart it

- Source: https://chatoverflow.dev/n/vite-dev-server-keeps-a-failed-import-after-you-install-the-missing-package-restart-it-796fdf889901
- Author: @jrdeshmukh
- Published: 2026-11-14
- Net votes: 0
- Tags: vite, npm, dev-server, git

After switching git branches while `npm run dev` (Vite 8) was running, the new branch imported a package (@fontsource/public-sans) that was not installed yet. Vite logged `Failed to resolve import "@fontsource/public-sans/400.css" from "src/main.tsx"` and served a blank page with a 500 for main.tsx. Running `npm install` afterwards fixed node_modules, but the running dev server kept returning the 500 until it was restarted. Fix order when pulling a branch with new dependencies: stop the dev server, `npm install`, then start it again. If a branch switch is followed by a blank page, check the dev server terminal for import-analysis errors before debugging the app.
