Tanstack start works locally but not deployed on railway

kevmokHOBBY

23 days ago

Hi there

Has anyone been able to deploy tanstack start with react 19.0.0 (which is the recommended version with bun)? It looks like it does not work I get the error:
[start]: preset:bun - Cannot find module "react-dom/server" from "/.output/server/index.mjs

I’m using railpack as well.

No issues on my local machine (of course 😭) but not sure why it’s not working when the app deploys in my project

Solved

0 Replies

kevmokHOBBY

23 days ago

f5376e47-25bc-4744-8e51-94719df911c0


alex-deliaPRO

23 days ago

https://railway.com/template/nAdb0P?referralCode=EmK2DS

i have a template here that deploys tanstack start


kevmokHOBBY

23 days ago

I see, I think my issue might be around using bun


alex-deliaPRO

23 days ago

is railpack recognizing bun in your settings

1360725588045860900


kevmokHOBBY

23 days ago

Yeah


kevmokHOBBY

23 days ago

1360748338252878000


kevmokHOBBY

23 days ago

In my local running bun --filter agora start which uses vinxi start works, but if i manually do bun .output/server/index.mjs i get the same error railway is surfacing


kevmokHOBBY

23 days ago

not sure if railway is not runing vinxi start


alex-deliaPRO

23 days ago

can you share your package.json?


kevmokHOBBY

23 days ago

{
    "name": "agora",
    "private": true,
    "type": "module",
    "scripts": {
        "start": "vinxi start",
        "build": "bun vinxi build --preset node-server",
        "local-build": "bun with-env vinxi build",
        "serve": "vite preview",
        "test": "vitest run",
        "dev": "bun with-env vinxi dev",
        "with-env": "bun --env-file=../../.env --bun",
        "ui:add": "bunx --bun shadcn@latest add"
    },
    "dependencies": {
        "@better-auth/stripe": "^1.2.5",
        "@daveyplate/better-auth-tanstack": "^1.3.2",
        "@daveyplate/better-auth-ui": "^1.3.21",
        "@efnf/eden": "workspace:*",
        "@efnf/types": "workspace:*",
        "@polar-sh/sdk": "^0.30.0",
        "@radix-ui/react-aspect-ratio": "^1.1.2",
        "@radix-ui/react-avatar": "^1.1.3",
        "@radix-ui/react-collapsible": "^1.1.3",
        "@radix-ui/react-dialog": "^1.1.6",
        "@radix-ui/react-dropdown-menu": "^2.1.6",
        "@radix-ui/react-label": "^2.1.2",
        "@radix-ui/react-radio-group": "^1.2.3",
        "@radix-ui/react-select": "^2.1.6",
        "@radix-ui/react-separator": "^1.1.2",
        "@radix-ui/react-slot": "^1.1.2",
        "@radix-ui/react-switch": "^1.1.3",
        "@radix-ui/react-tooltip": "^1.1.8",
        "@t3-oss/env-core": "^0.12.0",
        "@tailwindcss/postcss": "^4.0.7",
        "@tailwindcss/vite": "^4.0.6",
        "@tanstack/react-form": "^1.0.0",
        "@tanstack/react-query": "^5.66.11",
        "@tanstack/react-query-devtools": "^5.66.11",
        "@tanstack/react-router": "^1.104.1",
        "@tanstack/react-router-devtools": "^1.114.34",
        "@tanstack/react-router-with-query": "^1.112.0",
        "@tanstack/react-start": "^1.111.12",
        "@tanstack/react-store": "^0.7.0",
        "@tanstack/router-devtools": "^1.104.3",
        "@tanstack/router-plugin": "^1.105.0",
        "better-auth": "^1.2.5",
        "class-variance-authority": "^0.7.1",
        "clsx": "^2.1.1",
        "date-fns": "^4.1.0",
        "embla-carousel-react": "^8.5.2",
        "lucide-react": "^0.477.0",
        "mercury": "workspace:*",
        "next-themes": "^0.4.4",
        "postcss": "^8.5.2",
        "react": "^19.0.0",
        "react-dom": "^19.0.0",
        "sonner": "^2.0.1",
        "tailwind-merge": "^3.0.2",
        "tailwindcss": "^4.0.6",
        "tailwindcss-animate": "^1.0.7",
        "vinxi": "^0.5.3",
        "vite-tsconfig-paths": "^5.1.4",
        "zod": "^3.24.2"
    },
    "devDependencies": {
        "@testing-library/dom": "^10.4.0",
        "@testing-library/react": "^16.2.0",
        "@types/bun": "^1.2.4",
        "@types/react": "^19.0.8",
        "@types/react-dom": "^19.0.3",
        "@vitejs/plugin-react": "^4.3.4",
        "jsdom": "^26.0.0",
        "typescript": "^5.7.2",
        "vite": "^6.1.0",
        "vitest": "^3.0.5",
        "web-vitals": "^4.2.4"
    }
}

alex-deliaPRO

23 days ago

can you try removing the node server preset from your build command?


alex-deliaPRO

23 days ago

if youre using bun you should be using the bun preset not the node preset

// app.config.ts
import { defineConfig } from '@tanstack/react-start/config'

export default defineConfig({
server: {
preset: 'bun',
},
})

// Or you can use the --preset flag with the build command
// to specify the deployment target when building the application:
// npm run build --preset bun


kevmokHOBBY

23 days ago

I see, I encounter other errors with that then


alex-deliaPRO

23 days ago

might be worth asking about over in the tanstack discord


alex-deliaPRO

23 days ago

as well


kevmokHOBBY

23 days ago

Yeah good idea - i'll do that and update this thread


kevmokHOBBY

23 days ago

I figured it out!
So I used the preset you told me and instead of using the vinxi start command i just used the raw command bun run .output/server/index.mjs


kevmokHOBBY

23 days ago

!s


alex-deliaPRO

23 days ago

nice!


alex-deliaPRO

23 days ago

glad it worked out


21 days ago

thank you zander!


21 days ago

!s


Status changed to Solved brody 21 days ago