Skip to content

init -t start: fatal vite.config.ts patch failure + Convex/cRPC bootstrap silently skipped #278

@fingul

Description

@fingul

Summary

kitcn init -t start fails at the final vite.config.ts patch step. All earlier steps (TanStack Start scaffold, dependency install, shadcn components.json, src/components/ui/button.tsx, src/lib/utils.ts, src/styles.css) complete successfully — only the very last patch fails. As a side effect, the Convex / cRPC bootstrap step that the prompt offers (Run one-shot local Convex bootstrap after init completes? → Yes) is silently skipped: no convex/ directory, no src/lib/convex/ files, and neither kitcn nor convex are ever added to package.json.

Environment

OS macOS (Apple Silicon, Mac Studio 2)
Node v24.12.0
Bun 1.3.10
Package manager Bun (also reproduced via npx)

Versions tested — all reproduce the same error

kitcn version Released Result
0.15.8 (latest) 2026-05-27 ❌ same error
0.15.6 2026-05-22 ❌ same error
0.15.0 2026-05-14 ❌ same error
0.14.3 2026-05-06 ❌ same error

Steps to reproduce

```bash
mkdir test && cd test
npx kitcn@latest init -t start
```

Prompt answers:
```
◇ Run one-shot local Convex bootstrap after init completes? → Yes
✔ Would you like to set up a monorepo? → no
✔ Select a component library → Base
✔ Which preset would you like to use? → Lyra
```

Also reproduces with `bunx kitcn@latest init -t start --yes` (non-interactive) and with any of the versions in the table above.

Expected

  • `vite.config.ts` is patched (or skipped gracefully).
  • Convex / cRPC bootstrap runs and creates `convex/`, `src/lib/convex/{crpc.tsx,query-client.ts,convex-provider.tsx,server.ts}`, etc.
  • `kitcn` and `convex` end up in `package.json` `dependencies`.
  • `init` exits 0.

Actual

```
✔ Creating a new TanStack Start project.
✔ Writing components.json.
✔ Checking registry.
✔ Installing dependencies.
✔ Created 1 file:

  • src/components/ui/button.tsx
    ℹ Updated 1 file:
  • src/lib/utils.ts
    ✔ Updating src/styles.css

Project initialization completed.
You may now add components.

Error: Could not patch vite.config.ts: expected a resolve.alias block.
```

After this:

  • `convex/` does not exist
  • `src/lib/convex/` does not exist
  • `package.json` `dependencies` contains no `kitcn` and no `convex` (only TanStack Start, shadcn, base UI, Tailwind, React)
  • Process exits non-zero

`vite.config.ts` generated by current init (0.15.8 / 0.14.3 / etc.)

```ts
import { defineConfig } from "vite"
import { devtools } from "@tanstack/devtools-vite"
import { tanstackStart } from "@tanstack/react-start/plugin/vite"
import viteReact from "@vitejs/plugin-react"
import tailwindcss from "@tailwindcss/vite"

const config = defineConfig({
resolve: { tsconfigPaths: true },
plugins: [devtools(), tailwindcss(), tanstackStart(), viteReact()],
})

export default config
```

`vite.config.ts` from an older working project (created weeks ago with kitcn 0.14.3, still runs fine)

```ts
import { defineConfig } from "vite"
import { devtools } from "@tanstack/devtools-vite"
import { tanstackStart } from "@tanstack/react-start/plugin/vite"
import viteReact from "@vitejs/plugin-react"
import viteTsConfigPaths from "vite-tsconfig-paths"
import tailwindcss from "@tailwindcss/vite"
import { nitro } from "nitro/vite"

const config = defineConfig({
plugins: [
devtools(),
nitro(),
viteTsConfigPaths({ projects: ["./tsconfig.json"] }),
tailwindcss(),
tanstackStart(),
viteReact(),
],
})

export default config
```

Side note — peer warning

The CLI prints:
```
⚠️ kitcn expects convex >=1.38; found 1.34.1. Run `bun add convex@1.38.0` when you can.
```
even though `convex` is not yet declared in `dependencies` at that point.

Workaround used

Hand-edit `vite.config.ts`:

```ts
import path from "path"
import { defineConfig } from "vite"
import { devtools } from "@tanstack/devtools-vite"
import { tanstackStart } from "@tanstack/react-start/plugin/vite"
import viteReact from "@vitejs/plugin-react"
import tailwindcss from "@tailwindcss/vite"

const config = defineConfig({
resolve: {
alias: { "@": path.resolve(__dirname, "./src") },
},
plugins: [devtools(), tailwindcss(), tanstackStart(), viteReact()],
})

export default config
```

`bun --bun run dev` then starts the dev server. `kitcn`, `convex`, `@convex-dev/react-query`, `superjson`, etc. and all `src/lib/convex/*` plus `convex/functions/router.ts` wiring need to be added manually using an older working project as reference.

Happy to provide more debug info (full `package.json` diffs between working and broken installs, etc.) if useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions