2

Can anyone help me with this issue? When I execute npm run build and npm start locally, everything works fine. However, when I upload it to a server (I'm using Railway), it doesn't work, and the following message appears.

enter image description here

enter image description here

enter image description here

Web browser Message

enter image description here

Could anyone offer a solution and explain to me the reason for this issue? I have tried thousands of solutions, but none have worked, here is the code and configuration.

2
  • What build/server settings do you use locally? E.g. static or output: server with an adapter. You could also try using the client:only="react" directive when deployed to Railway (it will skip any server pre-rendering for this component if that's ok for your use case). Commented Nov 18, 2023 at 0:21
  • I used all directives, I think the problem lies in Railway Platform and how the container is built for dependencies, because I tried it in Vercel and it worked fine. I spent a lot of time trying to use it in Railway but eventually gave up. Maybe in future I will try again or anyone discover the problem. I will posted here. Thanks Commented Nov 20, 2023 at 2:58

1 Answer 1

1

Ran into this issue as well and found it was caused by Railway's way of auto detecting how to build the app. When I used Docker to build the app instead the issue went away. Used this guide here: https://docs.astro.build/en/recipes/docker/#_top

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.