Cannot use Tanstack Start inside of npm/pnpm workspaces #5398
Send to my agentWhich 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/@tanstack+start-plugin-core@1.132.48_@tanstack+react-router@1.132.47_react-dom@19.2.0_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/@tanstack+start-plugin-core@1.132.48_@tanstack+react-router@1.132.47_react-dom@19.2.0_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/@tanstack+start-plugin-core@1.132.48_@tanstack+react-router@1.132.47_react-dom@19.2.0_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/@tanstack+start-plugin-core@1.132.48_@tanstack+react-router@1.132.47_react-dom@19.2.0_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/@tanstack+start-plugin-core@1.132.48_@tanstack+react-router@1.132.47_react-dom@19.2.0_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/@tanstack+react-start@1.132.48_react-dom@19.2.0_react@19.2.0__react@19.2.0_vite@7.1.9_@types+node@22.18.8_tsx@4.20.6_/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#
Steps to Reproduce the Bug or Issue#
- Go to my reproduction repo: https://github.com/onlywei/pnpm-ws-tanstack-start
- 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/buggeronlywei(GitHub profile, opens in a new tab) changed the title
onlywei(GitHub profile, opens in a new tab) changed the title
onlywei(GitHub profile, opens in a new tab) changed the title
Similar issue #5350
@schiller-manuel thanks for merging #5408. I've now tested the new version, and now I have encountered the next issue:
packages/start-plugin-core/src/start-compiler-plugin/plugin.tsalso contains this snippet of code:...resolveRuntimeFiles({ package: `@tanstack/${framework}-start-client`, files: ['index.js'], }),I believe this is supposed to be either
react-start-clientorsolid-start-client. Without declaring the dependency, we run into the error:Error: Cannot find module '@tanstack/react-start-client/package.json'Whichever one is needed must also be declared in dependencies, and it seems like incorrect design to me to add both to dependencies. I think it could work if we declare both in
optionalDependencies, since they get installed by default, but it will still mean that both react-start-client and solid-start-client get installed on everyone's machines even if they need only one or the other. Do you have an opinion on this? c.c. @tannerlinsleyAny news on this?
I just ran pnpm create @tanstack/start@latest and got this exact same issue as well.
@highri5e please create a new issue including a complete reproducer project
Any news on this?
I just ran pnpm create @tanstack/start@latest and got this exact same issue as well.
I no longer experience this issue after #5409 was merged. I think you may need to make a repro like I did.
Sign in to join this conversation.
I also opened an issue with pnpm for this: https://github.com/pnpm/pnpm/issues/10048