R
Railway15mo ago
JoshOnX

my react vite app is failing

when i push it fails
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!...
Jump to solution
29 Replies
Percy
Percy15mo ago
Project ID: b81bf663-ab4b-4572-b559-1536c49bef71
JoshOnX
JoshOnXOP15mo ago
b81bf663-ab4b-4572-b559-1536c49bef71
Brody
Brody15mo ago
are you using a caddyfile?
JoshOnX
JoshOnXOP15mo ago
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
Floris
Floris15mo ago
whats the error? or log
JoshOnX
JoshOnXOP15mo ago
react vite hold on lemme screeenshot
Floris
Floris15mo ago
yes as react vite is just the framework im guessing
JoshOnX
JoshOnXOP15mo ago
yea
JoshOnX
JoshOnXOP15mo ago
No description
Floris
Floris15mo ago
ah ! go to your deployment and then to settings
JoshOnX
JoshOnXOP15mo ago
okay
Floris
Floris15mo ago
and then theres a field called start command
Floris
Floris15mo ago
No description
JoshOnX
JoshOnXOP15mo ago
yea i put "npm run dev " but it was still failing what should i put
Floris
Floris15mo ago
ahh! because the dev is your local dev server
JoshOnX
JoshOnXOP15mo ago
what should i write @morpheus9071
Floris
Floris15mo ago
you have npm, No yarn right?
JoshOnX
JoshOnXOP15mo ago
npm
Floris
Floris15mo ago
probably
npm run build
npm run build
or
vite build
vite build
show me your package.json in your repo that should contain stuff like this usually
JoshOnX
JoshOnXOP15mo ago
{ "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" } }
Floris
Floris15mo ago
oh ok yeah
npm run build
npm run build
should do the job it'll compile all your TS code and then it should execute vite build itself
JoshOnX
JoshOnXOP15mo ago
hmm okay lemme do that thanks boss
Floris
Floris15mo ago
yessir noworries bro
Brody
Brody15mo ago
Morpheus, I really do appreciate the assistance but unfortunately that isn't the proper solution OP, when you're online give me a holler
JoshOnX
JoshOnXOP15mo ago
hey am online it still not working out @Brody i test it in vercel it worked easyly
Brody
Brody15mo ago
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
Brody
Brody15mo ago
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!
JoshOnX
JoshOnXOP15mo ago
thanks a thon it worked like magic i have tested it thanks brody
Brody
Brody15mo ago
awesome, glad I could help
Want results from more Discord servers?
Add your server