R
Railwayβ€’6mo ago
Luis Reyes

Error: Docker build failed with npm

I am getting this error: ERROR: failed to solve: process "/bin/bash -ol pipefail -c npm run build" did not complete successfully: exit code: 1. I did npm run build locally and worked just fine
Solution:
@Luis Reyes please read the above conversation between me and fragly, and then read the below text. https://github.com/brody192/create-react-app-starter/tree/main copy the nixpacks.toml and Caddyfile from this repo into yours. this will tell nixpacks to download and run your app with caddy, both increasing site perform and significantly reducing resource usage....
Jump to solution
29 Replies
Percy
Percyβ€’6mo ago
Project ID: N/A
Fragly
Fraglyβ€’6mo ago
Mind downloading and sharing your build logs using this? https://bookmarklets.up.railway.app/log-downloader/
Luis Reyes
Luis Reyesβ€’6mo ago
on it ok, I made the bookmarklet using the code you provided but where is the data I should provide to you? also I activated the bookmarklet btw
Fragly
Fraglyβ€’6mo ago
Once you added the bookmarklet, you can go to your build logs and click on it it'll then download a txt file containing all your logs which you can send in here
Luis Reyes
Luis Reyesβ€’6mo ago
that's not working, is there any other option?
Luis Reyes
Luis Reyesβ€’6mo ago
Railway
404 - Page not found
Railway is an infrastructure platform where you can provision infrastructure, develop with that infrastructure locally, and then deploy to the cloud.
Fragly
Fraglyβ€’6mo ago
Not really, what browser are you using? I know from experience that it's a bit weird on opera, and know it definitally works on chrome
Luis Reyes
Luis Reyesβ€’6mo ago
Firefox, OS: Ubuntu 23.10 I'm going to try with Chrome just to make sure I am doing it correctly. I must paste the javascript code on the bookmark's name field, right? because it is not working either on Chrome
Luis Reyes
Luis Reyesβ€’6mo ago
ok, doing that now
Fragly
Fraglyβ€’6mo ago
seems like a bunch of linting issues
Luis Reyes
Luis Reyesβ€’6mo ago
just warnings, not big deal, as I mentioned I built it locally
Fragly
Fraglyβ€’6mo ago
Your linting issues is what's causing the build to fail You can either fix them or bypass them by setting a service variable CI to false
Luis Reyes
Luis Reyesβ€’6mo ago
I'm going to set a service variable, let me check It worked like a charm thank you
Fragly
Fraglyβ€’6mo ago
no problem!
Brody
Brodyβ€’6mo ago
you helped them run a development server -_-
Fragly
Fraglyβ€’6mo ago
I don't know what a development server is 😭
Brody
Brodyβ€’6mo ago
you know when you are working on a frontend site and it will hot reload your changes as you're coding? that's a development server, and that's what they are now running
Fragly
Fraglyβ€’6mo ago
Oooh, how do I see when someone runs something like that
Brody
Brodyβ€’6mo ago
they use considerably more memory and cpu resources, and as significantly less performant both vite and react-scripts (among other frontend tooling) do not have production servers built into them, if they aren't explicitly using a production web server (caddy, nginx, Apache) they are by default using a development server
Fragly
Fraglyβ€’6mo ago
Oh okay, thanks brody 🫑
Brody
Brodyβ€’6mo ago
so now what do we do
Fragly
Fraglyβ€’6mo ago
We tell him to not use a development server and use something like caddy instead for their web server?
Brody
Brodyβ€’6mo ago
true, but we can do one step better, we already have a template for create-react-app that uses caddy
Fragly
Fraglyβ€’6mo ago
oh okay, direct them to the template then? πŸ€”
Brody
Brodyβ€’6mo ago
even more specifically though
Solution
Brody
Brodyβ€’6mo ago
@Luis Reyes please read the above conversation between me and fragly, and then read the below text. https://github.com/brody192/create-react-app-starter/tree/main copy the nixpacks.toml and Caddyfile from this repo into yours. this will tell nixpacks to download and run your app with caddy, both increasing site perform and significantly reducing resource usage.
Fragly
Fraglyβ€’6mo ago
Thanks for teaching me brody :)