Installation
TanStack Router can be installed in React, Solid, or Vue applications. Choose your framework and package manager to get started.Prerequisites
Before installing TanStack Router, ensure you have:- Node.js 20.19 or higher
- A supported framework installed:
- React 18.0.0 or higher (or React 19+)
- Solid.js 1.9.10 or higher
- Vue 3.3.0 or higher
React Installation
Install TanStack Router for React applications.- npm
- pnpm
- yarn
- bun
Optional: DevTools
Install the DevTools package for debugging and development:- npm
- pnpm
- yarn
- bun
Optional: Router Plugin (File-Based Routing)
For file-based routing with automatic route generation, install the router plugin:- npm
- pnpm
- yarn
- bun
Configure Vite Plugin
If using Vite, add the plugin to yourvite.config.ts:
The router plugin supports Vite, Webpack, Rspack, and ESBuild. See the plugin documentation for configuration options for other bundlers.
Solid Installation
Install TanStack Router for Solid.js applications.- npm
- pnpm
- yarn
- bun
Optional: DevTools
Install the Solid DevTools package:- npm
- pnpm
- yarn
- bun
Optional: Router Plugin (File-Based Routing)
For file-based routing, install the router plugin:- npm
- pnpm
- yarn
- bun
Configure Vite Plugin
Add the plugin to yourvite.config.ts:
Vue Installation
Install TanStack Router for Vue applications.- npm
- pnpm
- yarn
- bun
Optional: DevTools
Install the Vue DevTools package:- npm
- pnpm
- yarn
- bun
Optional: Router Plugin (File-Based Routing)
For file-based routing, install the router plugin:- npm
- pnpm
- yarn
- bun
Configure Vite Plugin
Add the plugin to yourvite.config.ts:
Package Versions
The current stable version of TanStack Router is:v1.163.3 - All framework packages use the same version number for consistency.
TypeScript Configuration
TanStack Router requires TypeScript for the best experience. Ensure yourtsconfig.json includes:
Validation Libraries (Optional)
TanStack Router supports type-safe search parameter validation with popular validation libraries:Zod
- npm
- pnpm
- yarn
- bun
Valibot
- npm
- pnpm
- yarn
- bun
ArkType
- npm
- pnpm
- yarn
- bun
Verify Installation
To verify your installation is successful, create a simple test file:- React
- Solid
- Vue
Next Steps
Now that you have TanStack Router installed, you’re ready to build your first application:Quick Start Guide
Follow our step-by-step guide to create your first router
Troubleshooting
Module Not Found
If you see module resolution errors, ensure:- You’ve installed the correct package for your framework
- Your
tsconfig.jsonhasmoduleResolutionset tobundlerornode16 - You’ve restarted your development server after installation
Type Errors
If TypeScript shows errors:- Ensure you’re using TypeScript 5.4 or higher
- Enable
strictmode in yourtsconfig.json - Make sure you’ve registered your router type (covered in the Quick Start)
Plugin Issues
If the router plugin isn’t working:- Verify the plugin is listed before your framework plugin in the Vite config
- Check that the
targetoption matches your framework - Try clearing your build cache and restarting the dev server
For more help, visit our GitHub Discussions or join our Discord community.