---> Running in 0e34d471598d
> [email protected] build /app
> node scripts/build.js
Could not find a required file.
Name: index.html
Searched in: /app/public
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-08-05T14_49_57_665Z-debug.log
The command '/bin/sh -c npm run build ;' returned a non-zero code: 1
##[error]The command '/bin/sh -c npm run build ;' returned a non-zero code: 1
##[error]The process '/usr/bin/docker' failed with exit code 1
So there is the error "can’t find file" but actually THERE IS a public
directory with the index.html
file inside. I don’t know why this is happening…
Edit: Im adding the docker file used in config pipe
# -- Base node --
FROM node:13.7-alpine AS build
WORKDIR /app
COPY package.json /app
RUN npm install
COPY . /app
ARG BUILD_ENV
RUN npm run build ;
# -- final build --
FROM nginx:1.17.8-alpine
COPY --from=build /app/build /var/www
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
2
Answers
I notice you are running this on docker, so you did wrong on docker during copy your react app directory to docker container.
You have not added your
Dockerfile
code hereSo we suggest you to fix your dockerfile first. Also check your
.dockerignore
file and debug getting into docker container, if the directory exist there or notSo your docker file should be similar to this
It should be like this (Not
. /app
):