React build failed

siolalpinFREE

3 months ago

I am trying to launch a basic react webpage and i keep getting this error

✕ [stage-0 8/10] RUN --mount=type=cache,id=s/4b5ee329-4907-416d-9d63-3fff7fd3c7de-next/cache,target=/app/.next/cache --mount=type=cache,id=s/4b5ee329-4907-416d-9d63-3fff7fd3c7de-nodemodules/cache,target=/app/nodemodules/.cache npm run build
process "/bin/bash -ol pipefail -c npm run build" did not complete successfully: exit code: 1

Dockerfile:24

22 | # build phase

23 | COPY . /app/.

24 | >>> RUN --mount=type=cache,id=s/4b5ee329-4907-416d-9d63-3fff7fd3c7de-next/cache,target=/app/.next/cache --mount=type=cache,id=s/4b5ee329-4907-416d-9d63-3fff7fd3c7de-nodemodules/cache,target=/app/nodemodules/.cache npm run build

25 |

26 |

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

Error: Docker build failed

View Deploy details

ⓘ Deployment information is only viewable by project members and Railway employees.

Closed

6 Replies

3 months ago

Hello,

You have errors in your build logs, please view your build logs and correct all the errors given to you.

Best,

Brody


brody

Hello,You have errors in your build logs, please view your build logs and correct all the errors given to you.Best,Brody

siolalpinFREE

3 months ago

hello and thanks, i corrected all the errors but i am still having deploy error upon building image. it has to do with the package.json file. i believe your the one who created the react template? im trying to use that aswell but the package json needs to be changed im not sure what to


3 months ago

Hello,

I did create the template, but you are not deploying the template repo, you are deploying your own repo.

You have peer dependency issues, please resolve them.

Best,
Brody


siolalpinFREE

3 months ago

sorry but im not sure what you mean by peer dependancy issues? it runs fine on my system with no errors.

i tried adding your json to my code but im still having issues

{
  "name": "clanmackinnon",
  "version": "0.1.0",
  "private": true,
"scripts": {
    "start": "serve -s build",
    "dev": "react-scripts start",
    "build": "react-scripts build",
    "lint": "next lint"
  },


  "eslintConfig": {
    "extends": [
      "react-app"
    ]
  },

    "browserslist": {
      "production": [
        ">0.2%",
        "not dead",
        "not op_mini all"
      ],

    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "dependencies": {
    "@types/leaflet": "^1.9.16",
    "leaflet": "^1.9.4",
    "next": "15.1.4",
    "react": "^19.0.0",
    "react-dom": "^19.0.0",
    "react-leaflet": "^5.0.0",
    "react-slick": "^0.30.3",
    "react-scripts": "5.0.1",
    "slick-carousel": "^1.8.1"
  },
  "devDependencies": {
    "@eslint/eslintrc": "^3",
    "@types/node": "^20",
    "@types/react": "^19",
    "@types/react-dom": "^19",
    "@types/react-slick": "^0.23.13",
    "eslint": "^9",
    "eslint-config-next": "15.1.4",
    "postcss": "^8",
    "tailwindcss": "^3.4.1",
    "typescript": "^5"
  }
  
}

siolalpinFREE

3 months ago

Have you got this error before? even if i delete all my components i still get this rendering error, Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error

15:17:15.114

ReferenceError: window is not defined

15:17:15.115

at /vercel/path0/.next/server/app/page.js:1:7270

15:17:15.115

at 5077 (/vercel/path0/.next/server/app/page.js:1:153741)

15:17:15.115

at t (/vercel/path0/.next/server/webpack-runtime.js:1:128)

15:17:15.115

at 889 (/vercel/path0/.next/server/app/page.js:1:230899)

15:17:15.115

at Object.t [as require] (/vercel/path0/.next/server/webpack-runtime.js:1:128)

15:17:15.115

at require (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:131:7946)

15:17:15.115

at u (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:36:646)

15:17:15.115

at F (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:36:10477)

15:17:15.115

at W (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:36:13033)

15:17:15.115

at /vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:36:15283

15:17:15.115

Export encountered an error on /page: /, exiting the build.

15:17:15.120

⨯ Static worker exited with code: 1 and signal: null

15:17:15.155

Error: Command "npm run build" exited with 1


3 months ago

I'm sorry but we cannot help with application level issues here.


Status changed to Closed brody 3 months ago


React build failed - Railway Help Station