Skip to content

fix(create-vite): fix "too many arguments error" when using TanStack Router template with pnpm#21618

Closed
Natejsx wants to merge 2 commits intovitejs:mainfrom
Natejsx:main
Closed

fix(create-vite): fix "too many arguments error" when using TanStack Router template with pnpm#21618
Natejsx wants to merge 2 commits intovitejs:mainfrom
Natejsx:main

Conversation

@Natejsx
Copy link

@Natejsx Natejsx commented Feb 11, 2026

Resolves #21614

When running:

pnpm create vite@latest and selecting Framework: React Variant: TanStack Router, the following occurs:

error: too many arguments for 'create'. Expected 1 argument but got 4.

The cause is that getFullCustomCommand currently preserves the npm-specific argument separator (--). For pnpm dlx, the -- token is not required and causes subsequent flags (--template, --interactive) to be interpreted as positional arguments by the underlying create command.

This result in the argument count mismatch.

My proposed fix is adding a pnpm-specific normalization step in:

create-vite/src/index.ts (around line 919)

The update transforms:

pnpm dlx <pkg> --<args>

into:

pnpm dlx <pkg> <args>

this ensures flags are passed correctly and restores the TanStack Router flow.

I manually verified the flow locally. I was not able to run the full test suite in the environment.

@sapphi-red sapphi-red added the feat: create-vite create-vite package label Feb 13, 2026
Copy link
Member

@sapphi-red sapphi-red left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot test this right now due to TanStack/cli#364, but the description makes sense to me.

Comment on lines +914 to +917
if (pkgManager === 'pnpm') {
// `npm exec <pkg> -- <args>` uses `--` to split npm flags from package args. `pnpm dlx` doesn't need this separator, and keeping it can break CLIs.
command = command.replace(/^pnpm dlx (\S+) -- /, 'pnpm dlx $1 ')
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we handle this inside .replace(/^npm exec /, () => { like npm create does?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I refactored the code to fit within the .replace() function like npm create does.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's the new PR #21648
With the proposed changes!

@sapphi-red sapphi-red changed the title Fixed error when creating Vite React app with TanStack Router using pnpm fix(create-vite): fix "too many arguments error" when using TanStack Router template with pnpm Feb 13, 2026
@sapphi-red
Copy link
Member

=> #21648

@sapphi-red sapphi-red closed this Feb 17, 2026
Natejsx added a commit to Natejsx/vite that referenced this pull request Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat: create-vite create-vite package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error when creating Vite React app with TanStack Router using pnpm

2 participants