Docker build failed error

aman-codes-1HOBBY

a year ago

2 warnings found (use --debug to expand):

Jul 11 03:18:47

- UndefinedVar: Usage of undefined variable '$NIXPACKS_PATH' (line 18)

Jul 11 03:18:47

LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 18)

Jul 11 03:18:47

Jul 11 03:18:47

Dockerfile:24

Jul 11 03:18:47

-------------------

Jul 11 03:18:47

22 | # build phase

Jul 11 03:18:47

23 | COPY . /app/.

Jul 11 03:18:47

24 | >>> RUN --mount=type=cache,id=s/8632baa5-269e-4015-9723-3c2b57422924-node_modules/cache,target=/app/node_modules/.cache npm run build

Jul 11 03:18:47

25 |

Jul 11 03:18:47

26 |

Jul 11 03:18:47

-------------------

Jul 11 03:18:47

ERROR: failed to solve: process "/bin/bash -ol pipefail -c npm run build" did not complete successfully: exit code: 1

Jul 11 03:18:47

Jul 11 03:18:47

Error: Docker build failed

Solved

10 Replies


aman-codes-1HOBBY

a year ago

Logs:

Attachments


a year ago

Please tell me what you have your start script set to in your package.json


aman-codes-1HOBBY

a year ago

I don't have Dockerfile. It's a simple React app.


aman-codes-1HOBBY

a year ago

"start": "react-scripts start",

aman-codes-1HOBBY

a year ago

It was working perfectly few days ago. Some new builders introduced by railway yesterday with new UI


aman-codes-1HOBBY

a year ago

 "start": "react-scripts start",
 "build": "react-scripts build",

aman-codes-1HOBBY

a year ago

I think there maybe some issue with the railway's internal nixpacks.toml file.


a year ago

Not quite, this is a config issue of sorts.

First issue is that you are attempting to run a development server, that's going to be unstable and costly.

Here is an example repo for a create react app, and its setup to run a production ready web server -

https://github.com/brody192/create-react-app-starter

It should be as simple as copying its nixpacks.toml and Caddyfile into your repo.


aman-codes-1HOBBY

a year ago

"build": "CI=false react-scripts build",   fixed the issue

Status changed to Solved brody 11 months ago


Docker build failed error - Railway Help Station