, pnpm add, yarn add, or bun add — then restart the dev server."> , pnpm add, yarn add, or bun add — then restart the dev server." /> , pnpm add, yarn add, or bun add — then restart the dev server." />
AI Diagnostic Summary

Vite Failed to Resolve Import: Package Not Installed

Well-Documented Error

This error matches known, documented patterns with reliable solutions.

Quick Fix (Most Common Solution)

Seeing "Vite Failed to Resolve Import: Package Not Installed"? This error can be frustrating, but it's usually fixable. It typically affects your development workflow or system. Below you'll find clear, step-by-step solutions to resolve this issue.

High confidence
What This Error Means

Vite found an import statement that references a package or path it cannot find. Most often, the package was never installed, the package name is misspelled, node_modules is missing, or a path alias such as @ or ~ is not configured in vite.config.

Frequently documented in developer and vendor support forums.

Based on documented solutions and common real-world fixes.
Not affiliated with browser, OS, or device manufacturers.

New here? Learn why exact error messages matter →

Common Causes
  • Package not installed in this project
  • Package installed globally but not locally
  • Wrong package name or typo in the import
  • node_modules missing after cloning or switching branches
  • Using npm, pnpm, yarn, or bun inconsistently
  • Path alias such as @ or ~ not configured in vite.config
  • Monorepo dependency installed in the wrong workspace package
How to Fix
  1. Install the missing package: npm install or pnpm add or yarn add or bun add
  2. Restart the Vite dev server after installing the package
  3. Check that the import name exactly matches the package name in package.json
  4. Check that node_modules exists and reinstall dependencies if needed
  5. If the import starts with @ or ~, configure resolve.alias in vite.config
  6. In a monorepo, install the dependency in the workspace package that imports it

Last reviewed: June 2026 How we review solutions

Didn't fix it? Get a personalised solution

Works with any error — screenshots, terminal output, or device displays

or paste text
Quick Diagnostic Path
  • If The import is a package name like react-router-dom or axios Install the package: npm install
  • If The import starts with ./ or ../ Check the file path and filename — it may have a typo or the file may have moved
  • If The import starts with @ or ~ Configure the alias in vite.config using resolve.alias and match it in tsconfig paths
  • If You just cloned the project Run npm install (or pnpm install / yarn install) first — node_modules is not committed to git
  • If You use a monorepo Install the dependency in the workspace package that imports it, not just at the root
If This Still Fails, Check
  • After installing, always stop and restart the Vite dev server — running servers do not always pick up new packages
  • If you switch package managers mid-project, delete node_modules and the lock file before reinstalling
  • Global installs (npm install -g) do not make packages available to Vite — install locally in the project
Fast fix — install the missing package (choose your package manager)
npm install <package-name>
# or
pnpm add <package-name>
# or
yarn add <package-name>
# or
bun add <package-name>

# Then restart the dev server
npm run dev

OS-Specific Behavior

Vite Import Resolution Error Differences Between Windows and Unix Environments

Node.js applications developed on macOS or Linux often encounter Vite Import Resolution Error when deployed on Windows or run in WSL2, because of path separator differences, filesystem behavior, and shell command portability. The most common portability issue: hard-coded Unix path separators (/) in Node.js code work on macOS and Linux but fail on Windows native paths. Use Node's path.join() and path.resolve() rather than string concatenation — these functions use the correct separator for the current platform. For npm scripts that use shell commands, Windows does not have rm -rf, cp -r, or & for background processes — use the cross-env package for environment variables, rimraf for recursive deletion, and concurrently for parallel scripts. The process.platform property ('win32', 'darwin', 'linux') lets you branch platform-specific code explicitly. When Vite Import Resolution Error appears only on one OS, immediately check for hard-coded paths, shell command assumptions, and line ending handling.

Need reliable hosting?

DigitalOcean offers simple cloud infrastructure with $200 free credit for new users.

Try DigitalOcean →

We may earn a commission from tools recommended in our fixes.

Optional follow-up

Some users ask whether saving fixes for recurring errors would be useful when the same issue appears again.

Was this explanation helpful?

Explanations are based on documented fixes, real-world reports, and common system behavior. GetErrorHelp is independent and not affiliated with software vendors, device manufacturers, or service providers.
Frequently Asked Questions

How do I install the missing package?

Run npm install in your project root. If you use pnpm, run pnpm add . If you use yarn, run yarn add . If you use bun, run bun add .

Why does Vite still fail after installing the package?

Stop and restart the Vite dev server. New packages are not always picked up by a running dev server.

What if the import path starts with @ or ~?

That usually means the project uses an alias. Add the alias to vite.config using resolve.alias and make sure it matches your tsconfig paths if you use TypeScript.

What if the package is already installed?

Check for a spelling mismatch, a wrong import path, or installing the package in the wrong workspace. Also confirm the dependency appears in the correct package.json.

Related Resources

Also Known As

Common Search Variations

Related Errors
Still Stuck?

Paste a different error message or upload a screenshot to get help instantly.

Solutions are based on commonly documented fixes and may not apply in all situations.