【发布时间】:2020-09-14 21:17:51
【问题描述】:
我在运行 docker build 时遇到错误。问题是当docker运行npm install -f时,最初我将命令更改为npm install,但问题仍然存在。日志太长了我不能在这里发布更多细节here。下面是日志的 sn-p,日志的最后一部分未能完成构建。我还包括了Dockerfile。
注意:
当我在我的机器上本地运行npm run build 时,它完美地尝试在Dockerfile 中将npm run build --aot 更改为npm run build,但问题仍然存在。
日志
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
【问题讨论】:
标签: angular docker npm npm-install