Изучив журналы ниже, я заметил, что проблема связана с используемой мной версией узла, которая была v10.15.1
, а также имела устаревший пакет fsevents@1.2.13. Из Dockerfile
я пытался установить последнюю версию узла, которая несовместима с устаревшей версией пакета. Позже я обновил приложение до Angular 9 . В этой версии есть несколько новых критических изменений. Изменил также Dockerfile
. Мне не нужно было принудительно устанавливать с помощью npm i -f
или запускать npm audit fix
, имел все зависимости и обновлял. Важно упомянуть, всегда проверяйте свои зависимости в своем приложении, если они обновлены, и выясняйте, есть ли какие-либо критические изменения из документации пакета, это сэкономит вам много времени от исправления проблем с зависимостями.
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN notsup Unsupported engine for watchpack-chokidar2@2.0.0: wanted: {"node":"<8.10.0"} (current: {"node":"10.15.1","npm":"6.12.0"})
npm WARN notsup Not compatible with your version of node/npm: watchpack-chokidar2@2.0.0
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/watchpack-chokidar2/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/webpack-dev-server/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN notsup Unsupported engine for watchpack-chokidar2@2.0.0: wanted: {"node":"<8.10.0"} (current: {"node":"10.15.1","npm":"6.12.0"})
npm WARN notsup Not compatible with your version of node/npm: watchpack-chokidar2@2.0.0
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/watchpack-chokidar2/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/webpack-dev-server/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN @angular/animations@8.2.14 requires a peer of @angular/core@8.2.14 but none is installed. You must install peer dependencies yourself.
npm WARN @angular-devkit/build-angular@0.901.7 requires a peer of @angular/compiler-cli@>=9.0.0 < 10 but none is installed. You must install peer dependencies yourself.
npm WARN @angular-devkit/build-angular@0.901.7 requires a peer of typescript@>=3.6 < 3.9 but none is installed. You must install peer dependencies yourself.
npm WARN @ngtools/webpack@9.1.7 requires a peer of @angular/compiler-cli@>=9.0.0 < 10 but none is installed. You must install peer dependencies yourself.
npm WARN @ngtools/webpack@9.1.7 requires a peer of typescript@>=3.6 < 3.9 but none is installed. You must install peer dependencies yourself.
npm WARN sass-loader@8.0.2 requires a peer of node-sass@^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN sass-loader@8.0.2 requires a peer of fibers@>= 3.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN webpack-subresource-integrity@1.4.0 requires a peer of html-webpack-plugin@^2.21.0 || ~3 || >=4.0.0-alpha.2 <5 but none is installed. You must install peer dependencies yourself.
+ @angular-devkit/build-angular@0.901.7
added 254 packages from 127 contributors, removed 28 packages, updated 169 packages and moved 25 packages in 132.099s
fixed 4 of 9 vulnerabilities in 2093 scanned packages
3 package updates for 5 vulnerabilities involved breaking changes
(use `npm audit fix --force` to install breaking changes; or refer to `npm audit` for steps to fix these manually)
Обновленный Dockerfile
# stage 1
FROM node:latest as node
WORKDIR /app
COPY . .
RUN npm i
RUN npm run build --prod
# 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