my react vite app is failing
when i push it fails
Solution:Jump to solution
I've created a vite + react template to demonstrate how I would go about deploying a static frontend CSR app like react, that can be found here
https://github.com/brody192/vite-react-template
making your own app deployable should be as simple as copying the nixpacks.toml and Caddyfile from that repo into your repo.
let me know if that works for you!...
29 Replies
Project ID:
b81bf663-ab4b-4572-b559-1536c49bef71
b81bf663-ab4b-4572-b559-1536c49bef71
are you using a caddyfile?
sorry for the late response @brody192 i had to confirm and ask the enineer in charge but he said no
what do u think i should do
it a vite app
whats the error?
or log
react vite
hold on lemme screeenshot
yes
as react vite is just the framework im guessing
yea
ah !
go to your deployment
and then to settings
okay
and then theres a field called
start command
yea i put "npm run dev " but it was still failing
what should i put
ahh!
because the dev
is your local dev server
what should i write @morpheus9071
you have npm, No yarn right?
npm
probably
or
show me your package.json in your repo
that should contain stuff like this usually
{
"name": "emetric",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"dependencies": {
"@headlessui/react": "^1.7.17",
"@heroicons/react": "^2.0.18",
"@react-three/drei": "^9.84.2",
"@react-three/fiber": "^8.14.2",
"@types/three": "^0.156.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.16.0",
"react-select": "^5.7.5",
"three": "^0.156.1"
},
"devDependencies": {
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.7",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"@vitejs/plugin-react": "^4.0.3",
"autoprefixer": "^10.4.15",
"eslint": "^8.45.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.3",
"postcss": "^8.4.30",
"tailwindcss": "^3.3.3",
"typescript": "^5.0.2",
"vite": "^4.4.5"
}
}
oh ok
yeah
should do the job
it'll compile all your TS code
and then it should execute vite build itself
hmm okay lemme do that
thanks boss
yessir
noworries bro
Morpheus, I really do appreciate the assistance but unfortunately that isn't the proper solution
OP, when you're online give me a holler
hey am online
it still not working out
@Brody
i test it in vercel it worked easyly
yes vercel is purpose built for front end deployment, at a high level, they have a bunch of auto adapters that will deploy your site for a production environment depending on the frameworks in use. railway is not really purpose built for anyone one specific task and thus it will run your code as is, and as is, your code is not suited for a production deployment
but since railway can deploy a wider range of applications you can of course prepare your app for railway to deploy it in a suitable way
Solution
I've created a vite + react template to demonstrate how I would go about deploying a static frontend CSR app like react, that can be found here
https://github.com/brody192/vite-react-template
making your own app deployable should be as simple as copying the nixpacks.toml and Caddyfile from that repo into your repo.
let me know if that works for you!
thanks a thon
it worked like magic i have tested it thanks brody
awesome, glad I could help