How can I deploy Astro to the railway?

I tried several ways, but I'm more and more confused. There are ways to do this with Vercel, Netfly, but not with Astro and I haven't found any solution yet...
No description
19 Replies
La esencia de respirar
project ID: 0b2301a6-1a20-47a9-8d1c-45cc542ec177
Brody
Brody9mo ago
Cannot install with "frozen-lockfile" because pnpm-lock.yaml is not up to date with package.json
Cannot install with "frozen-lockfile" because pnpm-lock.yaml is not up to date with package.json
La esencia de respirar
And how do I fix that?
Brody
Brody9mo ago
delete your local lock file, run pnpm install, push the changes
La esencia de respirar
I tried but it didn't work
Brody
Brody9mo ago
build logs please
Brody
Brody9mo ago
your build has a lot of warnings, please fix them
La esencia de respirar
I'll try [Region: us-west1] ========================= Using Detected Dockerfile ========================= context: 4a8935b17b2aeac58fc2d8cdcf8c4c4c #0 building with "default" instance using docker driver #1 [internal] load build definition from Dockerfile #1 transferring dockerfile: 213B done #1 DONE 0.0s #2 [internal] load metadata for docker.io/library/caddy:alphine #2 ERROR: docker.io/library/caddy:alphine: not found -----
[internal] load metadata for docker.io/library/caddy:alphine:
----- Dockerfile:1 ------------------- 1 | >>> FROM caddy:alphine 2 | 3 | RUN apk update && apk add --no-cache nodejs pnpm ------------------- ERROR: failed to solve: caddy:alphine: docker.io/library/caddy:alphine: not found I tried to make a new project in Astro and now it also gives errors but shows fewer errors
Brody
Brody9mo ago
please use the bookmarklet
La esencia de respirar
I'll send it soon
Brody
Brody9mo ago
document is not defined

Hint: Browser APIs are not available on the server.

If the code is in a framework component, try to access these objects after rendering using lifecycle methods or use a `client:only` directive to make the component exclusively run on the client.

See https://docs.astro.build/en/guides/troubleshooting/#document-or-window-is-not-defined for more information.
document is not defined

Hint: Browser APIs are not available on the server.

If the code is in a framework component, try to access these objects after rendering using lifecycle methods or use a `client:only` directive to make the component exclusively run on the client.

See https://docs.astro.build/en/guides/troubleshooting/#document-or-window-is-not-defined for more information.
maddsua
maddsua9mo ago
Yep that can happen if you unintentionally import a module that uses browser api to a server component. Try to keep them as separate modules or at least ensure that a function that accesses document or window object is not called on server side (you can use typeof window !== 'undefined' to check for it)
La esencia de respirar
I end up not understanding how this works... Is there an example repository I can look at that is configured for railway up?
Brody
Brody9mo ago
your issue isn't with Railway, your issue is with your code, an example alone isn't going to do too much good to help you learn how to build an astro site
Want results from more Discord servers?
Add your server