node.js - Docker 的 Angular 图像因依赖错误而退出
问题描述
我的 docker 映像具有的节点版本 = v10.15.3 NPM 版本 = 6.4.1
下面是我的package.json,它是应用程序所有依赖项的列表。
{
},
"dependencies": {
"@akveo/ng2-completer": "^9.0.1",
"@angular/animations": "^10.0.10",
"@angular/cdk": "10.1.1",
"@angular/common": "^10.0.10",
"@angular/compiler": "^10.0.10",
"@angular/core": "^10.0.10",
"@angular/forms": "^10.0.10",
"@angular/google-maps": "^10.1.3",
"@angular/material": "^11.1.1",
"@angular/platform-browser": "^10.0.10",
"@angular/platform-browser-dynamic": "^10.0.10",
"@angular/router": "^10.0.10",
"@asymmetrik/ngx-leaflet": "3.0.1",
"@nebular/auth": "6.0.0",
"@nebular/eva-icons": "6.0.0",
"@nebular/security": "6.0.0",
"@nebular/theme": "6.0.0",
"@swimlane/ngx-charts": "^14.0.0",
"angular2-chartjs": "0.4.1",
"bootstrap": "4.3.1",
"chart.js": "2.7.1",
"ckeditor": "4.7.3",
"classlist.js": "1.1.20150312",
"core-js": "2.5.1",
"csv-parser": "^3.0.0",
"echarts": "^4.0.2",
"eva-icons": "^1.1.3",
"intl": "1.2.5",
"ionicons": "2.0.1",
"leaflet": "1.2.0",
"nebular-icons": "1.1.0",
"ng2-ckeditor": "^1.2.9",
"ng2-smart-table": "^1.6.0",
"ngx-echarts": "^4.2.2",
"node-sass": "^4.12.0",
"normalize.css": "6.0.0",
"pace-js": "1.0.2",
"roboto-fontface": "0.8.0",
"rxjs": "6.6.2",
"rxjs-compat": "6.3.0",
"socicon": "3.0.5",
"style-loader": "^1.1.3",
"tinymce": "4.5.7",
"tslib": "^2.0.0",
"typeface-exo": "0.0.22",
"web-animations-js": "^2.3.2",
"xlsx": "^0.16.9",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.1000.6",
"@angular/cli": "^10.0.6",
"@angular/compiler-cli": "^10.0.10",
"@angular/language-service": "10.0.10",
"@compodoc/compodoc": "1.0.1",
"@fortawesome/fontawesome-free": "^5.2.0",
"@types/d3-color": "1.0.5",
"@types/googlemaps": "^3.39.3",
"@types/jasmine": "2.5.54",
"@types/jasminewd2": "2.0.3",
"@types/leaflet": "1.2.3",
"@types/node": "^12.11.1",
"codelyzer": "^6.0.0",
"conventional-changelog-cli": "1.3.4",
"husky": "0.13.3",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.0.0",
"karma-chrome-launcher": "~3.1.0",
"karma-cli": "1.0.1",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~3.3.0",
"karma-jasmine-html-reporter": "^1.5.0",
"npm-run-all": "4.0.2",
"protractor": "~7.0.0",
"rimraf": "2.6.1",
"stylelint": "7.13.0",
"ts-node": "3.2.2",
"tslint": "~6.1.0",
"tslint-language-service": "^0.9.9",
"typescript": "3.9.7"
}
}
下面是我使用的Dockerfile 。
Dockerfile
FROM node:10.15.3-alpine AS node
WORKDIR /application
COPY . .
RUN npm install
RUN npm run build --prod
#Stage 2
FROM nginx:1.17.1-alpine
COPY --from=node /application/dist/application /usr/share/nginx/html
当它到达命令时:RUN npm run build --prod
编译一段时间后,它会抛出这个错误:
#13 262.8 ERROR in The target entry-point "ng2-smart-table" has missing dependencies:
#13 262.8 - ng2-completer
#13 262.8
#13 262.9 npm ERR! code ELIFECYCLE
#13 262.9 npm ERR! errno 1
#13 262.9 npm ERR! ngx-admin@6.0.0 build: `ng build`
#13 262.9 npm ERR! Exit status 1
#13 262.9 npm ERR!
#13 262.9 npm ERR! Failed at the ngx-admin@6.0.0 build script.
#13 262.9 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
#13 263.9
#13 263.9 npm ERR! A complete log of this run can be found in:
#13 263.9 npm ERR! /root/.npm/_logs/2021-04-10T13_17_44_149Z-debug.log
------
executor failed running [/bin/sh -c npm run build --prod]: exit code: 1
The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command docker build --pull --rm -f "Dockerfile" -t diacareportal1:v1 "."" terminated with exit code: 1.
我需要做什么才能让它工作?
解决方案
推荐阅读
- wpf - 列表框在选择时更改图像
- c# - 如何在 Azure Web App 上托管的 .NET Core 中检索 AD 用户名?
- asp.net-mvc - 如何使用其中包含列表的 Kendo UI 网格打开模式
- symfony - Symfony 3 - 无法在 PROD 环境中正确管理我的用户角色
- python - 如何使用 argparse 获得不带连字符(--)的可能参数列表
- azure-active-directory - MDM(不是 Intune)无法向 Azure AD 报告当前管理的设备的合规性状态
- python - SQLAlchemy 列创建顺序
- python - 重置 TensorFlow 亚当优化器
- node.js - 为每个公司的管理员创建路由登录
- javascript - 如何使用数组元素为选择框创建动态选项?并在另一个jsp页面中使用该选项框值?