I'm getting an error when I run docker build . The problem is when docker runs npm install -f, initially I changed the command to npm install but the problem still persists. The logs are too long I can't post them here for more detail here. Below is a snippet of the logs, the last part of the logs which is failing to complete the build. I have also included the Dockerfile.
Note:
When I run npm run build locally on my machine it works perfectly tried to change npm run build --aot to npm run build in the Dockerfile but the problem still persists.
Logs
Generating ES5 bundles for differential loading...
An unhandled exception occurred: [BABEL] /app/dist/e-county/src-app-receipting-receipting-module-es2015.js: Could not find plugin "proposal-numeric-separator". Ensure there is an entry in ./available-plugins.js for it. (While processing: "/app/node_modules/@babel/preset-env/lib/index.js")
See "/tmp/ng-j8ToFT/angular-errors.log" for further details.
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! e-county@0.0.0 build: `node --max_old_space_size=4096 node_modules/@angular/cli/bin/ng build`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the e-county@0.0.0 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/2020-05-27T17_41_05_761Z-debug.log
The command '/bin/sh -c npm run build --aot' returned a non-zero code: 1
Dockerfile
# stage 1
FROM node:latest as node
WORKDIR /app
COPY . .
RUN npm i -f && npm audit fix
RUN npm run build --aot
# stage 2
FROM nginx:alpine
RUN rm -rf /usr/share/nginx/html/*
COPY --from=node /app/nginx/* /etc/nginx/conf.d/default.conf
COPY --from=node /app/dist/e-county /usr/share/nginx/html