Skip to content

Cannot use Tanstack Start inside of npm/pnpm workspaces #5398

@onlywei

Description

@onlywei

Which project does this relate to?

Start

Describe the bug

I just went through this "get started from scratch "tutorial: https://tanstack.com/start/latest/docs/framework/react/build-from-scratch

I did it as an app inside my pnpm workspaces monorepo. Once I finished copy-pasting the files, I ran vite dev and I immediately got this error:

> vite dev

failed to load config from /path/to/pnpm-ws-tanstack-start/apps/bugger/vite.config.ts
error when starting dev server:
Error: Cannot find module '@tanstack/start-client-core/package.json'
Require stack:
- /path/to/pnpm-ws-tanstack-start/node_modules/.pnpm/@[email protected]_@[email protected][email protected]_r_a0fe3bb23a6bd406bb09f9f78351a029/node_modules/@tanstack/start-plugin-core/dist/esm/start-compiler-plugin/plugin.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1420:15)
    at require.resolve (node:internal/modules/helpers:163:19)
    at resolvePackage (file:///path/to/pnpm-ws-tanstack-start/node_modules/.pnpm/@[email protected]_@[email protected][email protected]_r_a0fe3bb23a6bd406bb09f9f78351a029/node_modules/@tanstack/start-plugin-core/dist/esm/start-compiler-plugin/plugin.js:20:41)
    at resolveRuntimeFiles (file:///path/to/pnpm-ws-tanstack-start/node_modules/.pnpm/@[email protected]_@[email protected][email protected]_r_a0fe3bb23a6bd406bb09f9f78351a029/node_modules/@tanstack/start-plugin-core/dist/esm/start-compiler-plugin/plugin.js:15:19)
    at startCompilerPlugin (file:///path/to/pnpm-ws-tanstack-start/node_modules/.pnpm/@[email protected]_@[email protected][email protected]_r_a0fe3bb23a6bd406bb09f9f78351a029/node_modules/@tanstack/start-plugin-core/dist/esm/start-compiler-plugin/plugin.js:45:18)
    at TanStackStartVitePluginCore (file:///path/to/pnpm-ws-tanstack-start/node_modules/.pnpm/@[email protected]_@[email protected][email protected]_r_a0fe3bb23a6bd406bb09f9f78351a029/node_modules/@tanstack/start-plugin-core/dist/esm/plugin.js:253:5)
    at tanstackStart (file:///path/to/pnpm-ws-tanstack-start/node_modules/.pnpm/@[email protected][email protected][email protected][email protected][email protected]_@[email protected][email protected]_/node_modules/@tanstack/react-start/dist/esm/plugin/vite.js:55:5)
    at file:///path/to/pnpm-ws-tanstack-start/apps/bugger/node_modules/.vite-temp/vite.config.ts.timestamp-1759873155088-873e011d8da378.mjs:12:5
    at ModuleJob.run (node:internal/modules/esm/module_job:371:25)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:702:26)
 ELIFECYCLE  Command failed with exit code 1.

Your Example Website or App

Reproducible repository

Steps to Reproduce the Bug or Issue

  1. Go to my reproduction repo: https://github.com/onlywei/pnpm-ws-tanstack-start
  2. Follow the README there, it's only 4 steps

Expected behavior

I expected vite to start without failing to load any files or modules.

Screenshots or Videos

No response

Platform

  • Router / Start Version: 1.132.47 / 1.132.48
  • OS: macOS
  • Browser: Irrelevant
  • Browser Irrelevant
  • Bundler: vite
  • Bundler Version: 7.1.9
  • NodeJS Version: 22.18.0

Additional Context

I tried doing this outside of a pnpm workspaces environment, and it worked fine.

I also tried switching to npm workspaces instead of pnpm, and it also did not work. See this branch. Interestingly, it has a different error:

> vite dev

failed to load config from /path/to/pnpm-ws-tanstack-start/apps/bugger/vite.config.ts
error when starting dev server:
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'vite-tsconfig-paths' imported from /path/to/pnpm-ws-tanstack-start/node_modules/.vite-temp/vite.config.ts.timestamp-1759873680811-d9d1a82b6e2e28.mjs
    at Object.getPackageJSONURL (node:internal/modules/package_json_reader:268:9)
    at packageResolve (node:internal/modules/esm/resolve:768:81)
    at moduleResolve (node:internal/modules/esm/resolve:858:18)
    at defaultResolve (node:internal/modules/esm/resolve:990:11)
    at #cachedDefaultResolve (node:internal/modules/esm/loader:768:20)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:745:38)
    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:318:38)
    at #link (node:internal/modules/esm/module_job:208:49)
npm error Lifecycle script `dev` failed with error:
npm error code 1
npm error path /path/to/pnpm-ws-tanstack-start/apps/bugger
npm error workspace bugger
npm error location /path/to/pnpm-ws-tanstack-start/apps/bugger

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions