2 years ago
Hi team…
I have difficulties when deploying a web app created with the Laravel frontend. I can run the web app correctly locally, but it loads without the templates when deploying to Railway. I have not been able to find documentation about it. I apologize in advance if the solution to my problem is documented, but I am Spanish and my English is very poor.
For the web app to run correctly locally, I must leave a terminal open with the npm run dev or npm run build command. When trying to execute the command in railway, the deploy does not finish.
Can you help me?
Thank you.
11 Replies
2 years ago
Hi Brody
I have already tried to try the solution you propose with both the biuld commands and the deploy commands. I will try again. Thank you!
Attachments
2 years ago
Thanks for your response Brody. I have been able to advance a little. I'll tell you what I have modified: I have eliminated the npm run build command from the variables, leaving them as they are below:
NIXPACKSBUILDCMD=composer update && composer install && php artisan optimize && php artisan config:cache && php artisan route:cache && php artisan view:cache && php artisan migrate --force
Now the frontend does not load and I get the following error screen in which it tells me to run npm run build
Attachments
2 years ago
It would not be ideal to set the build command via an environment variable, please use the build command field in the service settings.
You can tack on && npm run build to the default build command.
2 years ago
Nothing…I can't get the service to work through this Railway platform. I've been trying to solve the problem for two days. I'm sure it must be nonsense but I'm not able to see and detect the error.
Tomorrow I will try again.
2 years ago
I have used npm run build, npm run dev, npm run start on both the build and deploy command sides without success.
2 years ago
Hi brody;
I have followed your suggestions without success.
2 years ago
You haven't though?
You can tack on
&& npm run buildto the default build command.
You are also setting the build command in two different places, going forward, don't use the service variable to set it.