im currently trying to deploy a simple notes app on railway, part of a course challenge. The problem is that when i try to deploy it, i get the following message:
#13 ERROR: executor failed running [/bin/bash -ol pipefail -c npm run build]: exit code: 1
-----
> [stage-0 9/10] RUN --mount=type=cache,id=s/b5d79573-cbdb-4229-892e-e66e9714107f-node_modules/cache,target=/app/node_modules/.cache npm run build:
-----
executor failed running [/bin/bash -ol pipefail -c npm run build]: exit code: 1
Error: Docker build failed`
I don´t know if i have a step missing or what could be the problem.
Full deploy log looks like this:
`#11 9.230 npm WARN deprecated [email protected]: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
#11 14.98 npm WARN deprecated [email protected]: This SVGO version is no longer supported. Upgrade to v2.x.x.
#11 24.47
#11 24.47 added 1477 packages, and audited 1478 packages in 23s
#11 24.47
#11 24.47 225 packages are looking for funding
#11 24.47 run `npm fund` for details
#11 24.48
#11 24.48 6 high severity vulnerabilities
#11 24.48
#11 24.48 To address all issues (including breaking changes), run:
#11 24.48 npm audit fix --force
#11 24.48
#11 24.48 Run `npm audit` for details.
#11 DONE 24.8s
#12 [stage-0 8/10] COPY . /app/
#12 sha256:2d146d3acb5f7b6934547b67ce82a0f989ce063f5c00e1d16417c4615811a113
#12 DONE 0.1s
#13 [stage-0 9/10] RUN --mount=type=cache,id=s/b5d79573-cbdb-4229-892e-e66e9714107f-node_modules/cache,target=/app/node_modules/.cache npm run build
#13 sha256:0e2d30e554f378b0753874cd9b0b7a11b369b2136a5ff7e9aebc245d3e0350b1
#13 1.002 npm
WARN config production Use `--omit=dev` instead.
#13 1.020
#13 1.020 > [email protected] build
#13 1.020 > react-scripts build
#13 1.020
#13 3.128 Creating an optimized production build...
#13 13.27
#13 13.27 Treating warnings as errors because process.env.CI = true.
#13 13.27 Most CI servers set it automatically.
#13 13.27
#13 13.27 Failed to compile.
#13 13.27
#13 13.27 [eslint]
#13 13.27 src/App.js
#13 13.27 Line 2:8: 'axios' is defined but never used no-unused-vars
#13 13.27
#13 13.27 src/services/notes.js
#13 13.27 Line 20:1: Assign object to a variable before exporting as module default import/no-anonymous-default-export
#13 13.27
#13 13.27
#13 ERROR: executor failed running [/bin/bash -ol pipefail -c npm run build]: exit code: 1
-----
> [stage-0 9/10] RUN --mount=type=cache,id=s/b5d79573-cbdb-4229-892e-e66e9714107f-node_modules/cache,target=/app/node_modules/.cache npm run build:
-----
executor failed running [/bin/bash -ol pipefail -c npm run build]: exit code: 1
Error: Docker build failed`
I try deploying it on render.com aswell and get, what im thinking is that maybe i have to run run build in my react app for it to work? Sorry for the long code, it´s my first time deploying and i´m really stuck on this part.
Nov 8 09:27:22 PM ==> Cloning from https://github.com/Conwa/fullstackopen-excersices...
Nov 8 09:27:23 PM ==> Checking out commit 3dab108962d01d95622cb999c14c573a14e042fb in branch main
Nov 8 09:27:25 PM ==> Downloading cache...
Nov 8 09:27:35 PM ==> Transferred 33MB in 8s. Extraction took 0s.
Nov 8 09:27:38 PM ==> Installing dependencies with npm...
Nov 8 09:28:09 PM
Nov 8 09:28:09 PM > [email protected] postinstall /opt/render/project/src/part2/notes/node_modules/core-js
Nov 8 09:28:09 PM > node -e "try{require('./postinstall')}catch(e){}"
Nov 8 09:28:09 PM
Nov 8 09:28:09 PM
Nov 8 09:28:09 PM > [email protected] postinstall /opt/render/project/src/part2/notes/node_modules/core-js-pure
Nov 8 09:28:09 PM > node -e "try{require('./postinstall')}catch(e){}"
Nov 8 09:28:09 PM
Nov 8 09:28:10 PM added 1476 packages from 699 contributors and audited 1477 packages in 31.896s
Nov 8 09:28:11 PM
Nov 8 09:28:11 PM 225 packages are looking for funding
Nov 8 09:28:11 PM run `npm fund` for details
Nov 8 09:28:11 PM
Nov 8 09:28:11 PM found 1 high severity vulnerability
Nov 8 09:28:11 PM run `npm audit fix` to fix them, or `npm audit` for details
Nov 8 09:28:20 PM audited 1477 packages in 8.269s
Nov 8 09:28:21 PM
Nov 8 09:28:21 PM 225 packages are looking for funding
Nov 8 09:28:21 PM run `npm fund` for details
Nov 8 09:28:21 PM
Nov 8 09:28:21 PM found 1 high severity vulnerability
Nov 8 09:28:21 PM run `npm audit fix` to fix them, or `npm audit` for details
Nov 8 09:28:30 PM ==> Using Python version: 3.7.10
Nov 8 09:28:34 PM ==> Empty build command; skipping build
Nov 8 09:28:46 PM ==> Uploading build...
Nov 8 09:28:46 PM ==> Build folder build does not exist!
Nov 8 09:28:46 PM ==> Build failed 😞
I just had exactly the same issue. Turned out it was because of the following log: 'Treating warnings as errors because process.env.CI = true.'
I think it's because eslint is returning errors such as 'Line 2:8: 'axios' is defined but never used no-unused-vars' so it is stopping the build from compiling properly.
To fix it, change your build command to 'CI=false npm run build' under settings in Railway. That worked for me, though I'm new to this and don't think its the best-practice. Please feel to chime in more experienced devs!