Answer the question
In order to leave comments, you need to log in
How to fix this error when building Docker?
Have a Dockerfile
FROM node:14.1-alpine AS builder
WORKDIR /opt/web
COPY package.json package-lock.json ./
RUN npm install
ENV PATH="./node_modules/.bin:$PATH"
COPY . ./
RUN npm run build
FROM nginx:1.17-alpine
RUN apk --no-cache add curl
RUN curl -L https://github.com/a8m/envsubst/releases/download/v1.1.0/envsubst-`uname -s`-`uname -m` -o envsubst && \
chmod +x envsubst && \
mv envsubst /usr/local/bin
COPY ./nginx.config /etc/nginx/nginx.template
CMD ["/bin/sh", "-c", "envsubst < /etc/nginx/nginx.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"]
COPY --from=builder /opt/web/build /usr/share/nginx/html
server {
listen ${PORT:-80};
server_name _;
root /usr/share/nginx/html;
index index.html;
location / {
try_files $$uri /index.html;
}
}
docker build -t app .
gives the following error:
=> ERROR [builder 4/6] RUN npm install 157.3s
------
> [builder 4/6] RUN npm install:
#15 157.0 npm ERR! cb() never called!
#15 157.0
#15 157.0 npm ERR! This is an error with npm itself. Please report this error at:
#15 157.0 npm ERR!
#15 157.0
#15 157.0 npm ERR! A complete log of this run can be found in:
#15 157.0 npm ERR! /root/.npm/_logs/2021-03-24T14_05_59_782Z-debug.log
------
executor failed running [/bin/sh -c npm install]: exit code: 1
Answer the question
In order to leave comments, you need to log in
/root/.npm/_logs/2021-03-24T14_05_59_782Z-debug.log
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question