Skip to main content

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
Source: packages/react-router/package.json:117-119, packages/solid-router/package.json:124-126, packages/vue-router/package.json:93-95

React Installation

Install TanStack Router for React applications.

Optional: DevTools

Install the DevTools package for debugging and development:

Optional: Router Plugin (File-Based Routing)

For file-based routing with automatic route generation, install the router plugin:
Source: examples/react/quickstart-file-based/package.json:15

Configure Vite Plugin

If using Vite, add the plugin to your vite.config.ts:
Source: examples/react/quickstart-file-based/vite.config.js:1-13
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.

Optional: DevTools

Install the Solid DevTools package:
Source: examples/solid/basic/package.json:13-14

Optional: Router Plugin (File-Based Routing)

For file-based routing, install the router plugin:

Configure Vite Plugin

Add the plugin to your vite.config.ts:

Vue Installation

Install TanStack Router for Vue applications.

Optional: DevTools

Install the Vue DevTools package:

Optional: Router Plugin (File-Based Routing)

For file-based routing, install the router plugin:

Configure Vite Plugin

Add the plugin to your vite.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.
Source: packages/react-router/package.json:3, packages/solid-router/package.json:3, packages/vue-router/package.json:3

TypeScript Configuration

TanStack Router requires TypeScript for the best experience. Ensure your tsconfig.json includes:
TanStack Router works best with TypeScript’s strict mode enabled. Some features like type-safe navigation require strict type checking.

Validation Libraries (Optional)

TanStack Router supports type-safe search parameter validation with popular validation libraries:

Zod

Valibot

ArkType

Verify Installation

To verify your installation is successful, create a simple test file:
If there are no import errors, your installation is complete!

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:
  1. You’ve installed the correct package for your framework
  2. Your tsconfig.json has moduleResolution set to bundler or node16
  3. You’ve restarted your development server after installation

Type Errors

If TypeScript shows errors:
  1. Ensure you’re using TypeScript 5.4 or higher
  2. Enable strict mode in your tsconfig.json
  3. Make sure you’ve registered your router type (covered in the Quick Start)

Plugin Issues

If the router plugin isn’t working:
  1. Verify the plugin is listed before your framework plugin in the Vite config
  2. Check that the target option matches your framework
  3. Try clearing your build cache and restarting the dev server
For more help, visit our GitHub Discussions or join our Discord community.