TypeError: Cannot Read Properties Of Undefined (reading 'update') At Eval RouteTree.gen.ts:20:55
TypeError: Cannot read properties of undefined (reading 'update') at eval routeTree.gen.ts:20:55
In this article, we will be discussing a bug that occurs when creating a TanStack App using the create-tsrouter-app
command. The bug results in a TypeError: Cannot read properties of undefined (reading 'update')
error when running the npm run dev
command. We will go through the steps to reproduce the bug, the expected behavior, and the additional context provided.
Which Project Does This Relate To?
This bug relates to the TanStack App created using the create-tsrouter-app
command.
Describe the Bug
When creating a project using create-tsrouter-app
, running the npm run dev
command results in a 503 Server Unavailable
error along with a TypeError: Cannot read properties of undefined (reading 'update')
error. This error occurs in the eval
routeTree.gen.ts file at line 20:55.
Console Output During Creation of App
The console output during the creation of the app is as follows:
npx create-tsrouter-app@latest --add-ons
Need to install the following packages:
create-tsrouter-app@0.6.3
Ok to proceed? (y) y
┌ Let's configure your TanStack application
│
â—‡ What would you like to name your project?
│ web
│
â—‡ Select the router type:
│ File Router - File-based routing structure
│
â—‡ Would you like to use Tailwind CSS?
│ Yes
│
â—‡ Select toolchain
│ none
│
â—† What add-ons would you like for your project:
â—‡ What add-ons would you like for your project:
│ Netlify, Sentry, Shadcn, Start, TanStack Query
│
â—‡ Would you like any examples?
│ none
│
â—‡ Sentry setup complete
│
â—‡ Start setup complete
│
â—‡ Netlify setup complete
│
â—‡ Shadcn setup complete
│
â—‡ TanStack Query setup complete
│
â—‡ Installed dependencies
│
â–² TanStack Start is not yet at 1.0 and may change significantly or not be compatible with other add-ons.
│
â—‡ Initialized git repository
│
â”” Created your new TanStack app in 'web'.
Use the following commands to start your app:
% cd web
% npm dev
Please read README.md for more information on testing, styling, adding routes, react-query, etc.
Your Example Website or App
The example website or app can be found at https://github.com/saurabh-chawla-work/test.
Steps to Reproduce the Bug or Issue
To reproduce the bug or issue, follow these steps:
- Run the command
npx create-tsrouter-app@latest --add-ons
- Name the project as
web
- Select the router type as
File Router
- Select
Yes
for Tailwind CSS - Select
none
for toolchain - Select the add-ons as
Netlify, Sentry, Shadcn, Start, TanStack Query
- Select
none
for examples - Run the command
cd web
and thennpm run dev
Expected Behavior
The expected behavior is that the index page should show up when running the npm run dev
command.
Screenshots or Videos
Screenshots or videos of the issue can be found at https://github.com/user-attachments/assets/395fbcf7-50e1-43ab-87f1-77413f6772fb and https://github.com/user-attachments/assets/364fc88a-fc08-41d0-b072-4767a8d1049b.
Platform
The platform used to reproduce the bug is:
- OS: macOS 15.1.1 (24B91)
- Browser: Chrome 133.0.6943.143
- Version: 0.6.3
Additional Context
No additional context is provided.
Conclusion
Q: What is the cause of the TypeError: Cannot read properties of undefined (reading 'update') at eval routeTree.gen.ts:20:55 error?
A: The cause of the error is due to an issue with the create-tsrouter-app
command. When creating a new project, the command fails to properly configure the routing system, resulting in an undefined value being passed to the update
method.
Q: Why does the error occur only when running npm run dev?
A: The error occurs only when running npm run dev
because the command is trying to evaluate the SSR module $vinxi/handler/ssr
which is causing the error. This module is not properly configured, resulting in the undefined value being passed to the update
method.
Q: How can I fix the error?
A: To fix the error, you can try the following:
- Run the command
npm uninstall create-tsrouter-app
to uninstall thecreate-tsrouter-app
package. - Run the command
npm install create-tsrouter-app@latest
to reinstall the package. - Run the command
npx create-tsrouter-app@latest --add-ons
to recreate the project. - Check the
routeTree.gen.ts
file to ensure that the routing system is properly configured.
Q: Why does the error persist even after reinstalling the package?
A: The error may persist even after reinstalling the package if the issue is not related to the package itself, but rather to the configuration of the project. In this case, you may need to manually configure the routing system or check for any other issues that may be causing the error.
Q: Can I use a different package to create a TanStack App?
A: Yes, you can use a different package to create a TanStack App. Some popular alternatives include create-tanstack-app
and tanstack-app
. However, be aware that these packages may have different configurations and requirements.
Q: How can I get help with the error?
A: If you are experiencing issues with the error, you can try the following:
- Check the official documentation for the
create-tsrouter-app
package for any known issues or solutions. - Search online for any existing solutions or workarounds.
- Reach out to the community for help and support.
- File a bug report with the package maintainers.
Q: Is this error specific to the TanStack App?
A: No, this error is not specific to the TanStack App. It can occur with any project that uses the create-tsrouter-app
package. However, the error may be more common with the TanStack App due to its complex routing system.
Q: Can I prevent the error from occurring in the future?
A: Yes, you can prevent the error from occurring in the future by:
- Regularly updating the
create-tsrouter-app
package to the latest version. - Checking the
routeTree.gen.ts
file for any issues or errors. - Manually configuring the routing system to ensure that it is properly set up.
- Using a different package to create a TanStack App if the issue persists.