Cannot find module error when using pnpm
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 52/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- node.js, typescript, vite
- Domain
- build-system, cli
Research direction
Reproduce the issue with pnpm dlx @tanstack/cli@latest create my-app, then compare the generated app with one created using npx and inspect the failing router-manifest.js path and router-manifest.ts entry point shown in the trace. Done means a project scaffolded with pnpm starts with pnpm run dev and renders the template app without the missing-module error.
Written by the indexing model from the issue text.
Description
Which project does this relate to?
Create Tanstack App
Describe the bug
When creating new project via pnpm dlx @tanstack/cli@latest create, the resulting app throws Error: Cannot find module 'tanstack-start-injected-head-scripts:v' when visiting localhost:3000.
Note that if using npx @tanstack/cli@latest create,everything works as expected. This issues appears to affect pnpm only.
Your Example Website or App
Not applicable, run cli as normal
Steps to Reproduce the Bug or Issue
- Run
pnpm dlx @tanstack/cli@latest create my-app - Select all default settings
cd my-apppnpm run dev- Navigate to
localhost:3000in browser - Observe error message in browser and terminal
Expected behavior
Expect to see template Tanstack Start app in browser. Browser displays {"status":500,"unhandled":true,"message":"HTTPError"} instead.
Terminal displays:
VITE v8.0.14 ready in 2348 ms
➜ Local: http://localhost:3000/
➜ Network: use --host to expose
➜ press h + enter to show help
4:06:33 pm [vite] (ssr) connected.
Error: Cannot find module 'tanstack-start-injected-head-scripts:v' imported from '/Users/Braden/Projects/my-app/node_modules/.pnpm/@tanstack+start-server-core@1.169.3/node_modules/@tanstack/start-server-core/dist/esm/router-manifest.js'
at fetchModule (file:///Users/Braden/Projects/my-app/node_modules/.pnpm/vite@8.0.14_jiti@2.7.0/node_modules/vite/dist/node/chunks/node.js:23110:32)
... 8 lines matching cause stack trace ...
at ModuleRunner.getModuleInformation (file:///Users/Braden/Projects/my-app/node_modules/.pnpm/vite@8.0.14_jiti@2.7.0/node_modules/vite/dist/node/module-runner.js:1199:28) {
cause: Error: Cannot find module 'tanstack-start-injected-head-scripts:v' imported from '/Users/Braden/Projects/my-app/node_modules/.pnpm/@tanstack+start-server-core@1.169.3/node_modules/@tanstack/start-server-core/dist/esm/router-manifest.js'
at fetchModule (file:///Users/Braden/Projects/my-app/node_modules/.pnpm/vite@8.0.14_jiti@2.7.0/node_modules/vite/dist/node/chunks/node.js:23110:32)
at RunnableDevEnvironment.fetchModule (file:///Users/Braden/Projects/my-app/node_modules/.pnpm/vite@8.0.14_jiti@2.7.0/node_modules/vite/dist/node/chunks/node.js:24798:10)
at fetchModule (file:///Users/Braden/Projects/my-app/node_modules/.pnpm/vite@8.0.14_jiti@2.7.0/node_modules/vite/dist/node/chunks/node.js:24748:17)
at handleInvoke (file:///Users/Braden/Projects/my-app/node_modules/.pnpm/vite@8.0.14_jiti@2.7.0/node_modules/vite/dist/node/chunks/node.js:26564:27)
at EventEmitter.listenerForInvokeHandler (file:///Users/Braden/Projects/my-app/node_modules/.pnpm/vite@8.0.14_jiti@2.7.0/node_modules/vite/dist/node/chunks/node.js:26619:19)
at EventEmitter.emit (node:events:509:28)
at Object.send (file:///Users/Braden/Projects/my-app/node_modules/.pnpm/vite@8.0.14_jiti@2.7.0/node_modules/vite/dist/node/chunks/node.js:10788:37)
at Object.invoke (file:///Users/Braden/Projects/my-app/node_modules/.pnpm/vite@8.0.14_jiti@2.7.0/node_modules/vite/dist/node/module-runner.js:606:31)
at Object.invoke (file:///Users/Braden/Projects/my-app/node_modules/.pnpm/vite@8.0.14_jiti@2.7.0/node_modules/vite/dist/node/module-runner.js:655:31)
at ModuleRunner.getModuleInformation (file:///Users/Braden/Projects/my-app/node_modules/.pnpm/vite@8.0.14_jiti@2.7.0/node_modules/vite/dist/node/module-runner.js:1199:28) {
code: 'ERR_MODULE_NOT_FOUND',
runnerError: Error: RunnerError
at reviveInvokeError (file:///Users/Braden/Projects/my-app/node_modules/.pnpm/vite@8.0.14_jiti@2.7.0/node_modules/vite/dist/node/module-runner.js:547:64)
at Object.invoke (file:///Users/Braden/Projects/my-app/node_modules/.pnpm/vite@8.0.14_jiti@2.7.0/node_modules/vite/dist/node/module-runner.js:620:11)
at async ModuleRunner.getModuleInformation (file:///Users/Braden/Projects/my-app/node_modules/.pnpm/vite@8.0.14_jiti@2.7.0/node_modules/vite/dist/node/module-runner.js:1199:7)
at async request (file:///Users/Braden/Projects/my-app/node_modules/.pnpm/vite@8.0.14_jiti@2.7.0/node_modules/vite/dist/node/module-runner.js:1216:83)
at async getStartManifest (/Users/Braden/Projects/my-app/node_modules/.pnpm/@tanstack+start-server-core@1.169.3/node_modules/@tanstack/start-server-core/src/router-manifest.ts:61:17)
at async computeFinalManifest (/Users/Braden/Projects/my-app/node_modules/.pnpm/@tanstack+start-server-core@1.169.3/node_modules/@tanstack/start-server-core/src/finalManifest.ts:264:13)
at async executeRouter (/Users/Braden/Projects/my-app/node_modules/.pnpm/@tanstack+start-server-core@1.169.3/node_modules/@tanstack/start-server-core/src/createStartHandler.ts:480:26)
at async next (/Users/Braden/Projects/my-app/node_modules/.pnpm/@tanstack+start-server-core@1.169.3/node_modules/@tanstack/start-server-core/src/createStartHandler.ts:229:16)
at async handleServerRoutes (/Users/Braden/Projects/my-app/node_modules/.pnpm/@tanstack+start-server-core@1.169.3/node_modules/@tanstack/start-server-core/src/createStartHandler.ts:735:15)
at async eval (/Users/Braden/Projects/my-app/node_modules/.pnpm/@tanstack+start-server-core@1.169.3/node_modules/@tanstack/start-server-core/src/createStartHandler.ts:543:22)
},
status: 500,
statusText: undefined,
headers: undefined,
data: undefined,
body: undefined,
unhandled: true
}
Screenshots or Videos
No response
Platform
- OS: macOS
- Browser: Safari, Chrome
Additional context
No response
- Dominant language
- TypeScript
- Stars
- 1.3k
- Forks
- 185
- Avg merge
- 18h 45m
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from TanStack/cli
-
create: scaffold's unlayered body styles defeat its own @layer base rules (and any shadcn theme) Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 45/100
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 58/100
-
Difficulty 4/5 3-5 days Newbie friendliness 68/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
safetrustcr/dApp-SafeTrust#426 ·
-
area:workflow bug ready-for-agent
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
fil-donadoni/tolaria#4409 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Fission-AI/OpenSpec#1960 ·
-
Add dependabot Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
corsairdev/corsair#1764 ·