R
Railwayβ€’11mo ago
wannarock303

deploy logs say nuxt "start" is an unknown command. Production and development sites both crashed.

😫
Solution:
yes nuxt start starts a development / preview app, definitely dont want to be running that in production, make sure your build command is nuxt build and your start command is node .output/server/index.mjs make sure you set these commands in the scripts portion of your package.json and clear any build or start commands you may have set in your service settings...
Jump to solution
29 Replies
Percy
Percyβ€’11mo ago
Project ID: c456ec14-dbcb-44b0-8e8f-2c97ee12bf57
wannarock303
wannarock303β€’11mo ago
c456ec14-dbcb-44b0-8e8f-2c97ee12bf57 I pushed a navigation bugfix and everything was working beautifully as of ... 3 hours ago. My test users came back and gave production a green light. I have been referencing pages on prod since then. At just about an hour ago, the site started looking weird and then crashed. I have tried redeploying and this is what I'm seeing in logs.
Brody
Brodyβ€’11mo ago
doesn't nuxt start start a development server?
wannarock303
wannarock303β€’11mo ago
I'm runnign this in my test environment right now. I'll check prod ... hmmmmm And it's the same issue in prod. but my node_env is set to production ... I'm looking again at my node deployment. And no nuxt start starts the server for production as well.
Brody
Brodyβ€’11mo ago
nuxt 3 or 2?
wannarock303
wannarock303β€’11mo ago
I'm running 3
Brody
Brodyβ€’11mo ago
good choice
wannarock303
wannarock303β€’11mo ago
my first nuxt3 app so maybe I'm wrong.
Brody
Brodyβ€’11mo ago
i am in the process of confirming this
wannarock303
wannarock303β€’11mo ago
Thanks for helping. We have an event running and people can't access our event page. 😦
Brody
Brodyβ€’11mo ago
i cant find the nuxt cli docs lol link me if you can find it
wannarock303
wannarock303β€’11mo ago
.... looking now too what I don't get is why the site was deployed and running fine. And three hours later it crashes and I start seeing these problems. It's been live on Railway for over a month with no changes to deployment.
Solution
Brody
Brodyβ€’11mo ago
yes nuxt start starts a development / preview app, definitely dont want to be running that in production, make sure your build command is nuxt build and your start command is node .output/server/index.mjs make sure you set these commands in the scripts portion of your package.json and clear any build or start commands you may have set in your service settings
wannarock303
wannarock303β€’11mo ago
Okay I will try that now ...
Brody
Brodyβ€’11mo ago
if it still doesnt work, please send me your package.json as a file
wannarock303
wannarock303β€’11mo ago
okay create a script with the line you indicated above "prodserve": "node output/server/index.mjs" in my package.json . and updated my deploy setting for the "Start Command" to be "npm start prodserve" pushing develop to get the deploy triggered in my test env.
Brody
Brodyβ€’11mo ago
not really what i said to do lol
wannarock303
wannarock303β€’11mo ago
?
Brody
Brodyβ€’11mo ago
give this another read over
wannarock303
wannarock303β€’11mo ago
1. build command is nuxt build --- it is 2. start command is node output/server/index.mjs --- which it now is in a script entry I called "prodserve" in my package.json 3. "make sure you set these commands in the scripts portion of your package.json" -- exactly what is in 1 & 2 above 4. is it just the clearing out of the start and build commands? - I cleared out the npm run start entry and replaced it with prodserve
However my last test build succeeded and the site is running. I'll try that in prod.
Brody
Brodyβ€’11mo ago
I did ask you to name it start for a reason, it works the same in the end though I guess
wannarock303
wannarock303β€’11mo ago
BTW ... we missed a "." in the start script . lol it's actually 'node .output/server/index.mjs'
Brody
Brodyβ€’11mo ago
good catch on that one
mjfw
mjfwβ€’11mo ago
resolved?
wannarock303
wannarock303β€’11mo ago
I get where you were going with replacing actual "start" So if I leave those settings blank in the deployment settings, then the deploy will look for standard scripts like "start" and "build"? Prod is up! Yes, resolved. Thank you!
Brody
Brodyβ€’11mo ago
correct, but you have it named prodserve and that's why I asked you to name it start
wannarock303
wannarock303β€’11mo ago
understood Thank you for your help.
Brody
Brodyβ€’11mo ago
no problem πŸ™‚
Brody
Brodyβ€’11mo ago
don't worry, I added the period