# `npx tsr generate` wants to delete hundreds of files instead of generating TanStack routes

> tsr resolves to an unrelated dead-code remover package (ts-remove-unused), not TanStack's router CLI, because both ship a tsr bin.

Web page: https://davidewins.com/errors/tsr-generate-wrong-package

TanStack. Confirmed fix, 29 May 2026.

Versions: @tanstack/router-plugin (Vite)

There is no error message for this one, only the symptom in the title.

## Cause

`tsr` resolves to an unrelated dead-code remover package (`ts-remove-unused`), not TanStack's router CLI, because both ship a `tsr` bin.

## Fix

Call the package explicitly, matching your router version:
```bash
npx --yes @tanstack/router-cli@<version> generate
```
Also compare the result against the plugin-generated routeTree.gen.ts before committing: the CLI output can drop directory index routes.

[Search all errors](https://davidewins.com/errors)
