The frontend does not load correctly

knario80
HOBBY

a year 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

knario80
HOBBY

a year ago

73fd2cce-d577-45e6-b3cb-3902254c1211


a year ago

Try adding npm run build to your build command in the service settings.


knario80
HOBBY

a year 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


knario80
HOBBY

a year 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


a year 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.


knario80
HOBBY

a year 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.


a year ago

What is your latest build command you have tried?


knario80
HOBBY

a year ago

I have used npm run build, npm run dev, npm run start on both the build and deploy command sides without success.


a year ago

Please try with my suggestion above.


knario80
HOBBY

a year ago

Hi brody;
I have followed your suggestions without success.


a year ago

You haven't though?

You can tack on && npm run build to 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.