在CI-CD天蓝色devops中发布angular + .net核心项目时,无法读取未定义的属性“种类”

时间:2019-10-30 13:44:32

标签: angular asp.net-core webpack azure-devops devops

在CI-CD步骤(发布)中运行ng build --prod命令时,我们遇到以下错误。


    ./node_modules/ng-multiselect-dropdown/fesm5/ng-multiselect-dropdown.js中的
  • 错误 模块构建失败(来自 ./node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js):TypeError:无法读取未定义的属性“种类”

这里是我的package.json供依赖项参考。

{
"name": "XYZ",
"version": "7.1.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"ng": "ng",
"publish": "ng build --prod",
"start": "ng serve --host 0.0.0.0 --port 4200",
"hmr": "ng serve --host 0.0.0.0 --port 4200 --hmr",
"test": "ng test",
"pree2e": "webdriver-manager update --standalone false --gecko false",
"e2e": "protractor"
  },
"private": false,
"dependencies": {
"@angular/animations": "^8.0.0",
"@angular/cdk": "^8.0.0",
"@angular/common": "^8.0.0",
"@angular/compiler": "^8.0.0",
"@angular/core": "^8.0.0",
"@angular/forms": "^8.0.0",
"@angular/platform-browser": "^8.0.0",
"@angular/platform-browser-dynamic": "^8.0.0",
"@angular/platform-server": "^8.0.0",
"@angular/router": "^8.0.0",
"@aspnet/signalr": "^1.1.4",
"@swimlane/ngx-charts": "^12.0.1",
"abp-ng2-module": "^4.0.0",
"abp-web-resources": "^3.8.5",
"adal-angular": "^1.0.17",
"angular2-counto": "^1.2.5",
"angular2-template-compiler": "^0.1.9",
"angular2-text-mask": "^9.0.0",
"animate.css": "^3.7.1",
"chart.js": "^2.8.0",
"cookieconsent": "^3.1.1",
"core-js": "^3.1.3",
"famfamfam-flags": "^1.0.0",
"jquery": "^3.4.1",
"js-cookie": "^2.2.0",
"localforage": "^1.7.3",
"lodash": "^4.17.15",
"moment": "^2.24.0",
"moment-timezone": "^0.5.25",
"ng-multiselect-dropdown": "^0.2.5",
"ng-recaptcha": "^4.3.0",
"ng2-file-upload": "^1.3.0",
"ng2-search-filter": "^0.5.1",
"ngx-bootstrap": "^4.3.0",
"ngx-daterangepicker-material": "^2.1.8",
"ngx-image-cropper": "^1.3.10",
"ngx-perfect-scrollbar": "^7.2.1",
"object-path": "^0.11.4",
"oidc-client": "^1.9.1",
"primeicons": "^1.0.0",
"primeng": "^8.0.0",
"push.js": "^1.0.9",
"quill": "^1.3.6",
"rtl-detect": "^1.0.2",
"rxjs": "^6.5.3",
"simple-line-icons": "^2.4.1",
"sweetalert2": "^8.11.6",
"text-mask-addons": "^3.8.0",
"volo-angular-oauth2-oidc": "^5.0.2",
"zone.js": "~0.9.1",
"webpack-dev-server": "^3.1.5"


  },
"devDependencies": {
"@angular-devkit/build-angular": "~0.800.1",
"@angular/cli": "^8.0.1",
"@angular/compiler-cli": "^8.0.0",
"@angularclass/hmr": "^2.1.3",
"@angularclass/hmr-loader": "^3.0.4",
"@types/jasmine": "~3.3.13",
"@types/jasminewd2": "~2.0.6",
"@types/jquery": "^3.3.31",
"@types/lodash": "^4.14.133",
"@types/moment-timezone": "^0.5.12",
"@types/node": "^12.0.4",
"codelyzer": "^5.0.1",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "^4.2.1",
"karma": "^4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-cli": "~2.0.0",
"karma-coverage-istanbul-reporter": "^2.0.5",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.2",
"nswag": "12.3.1",
"protractor": "~5.4.2",
"ts-node": "~8.2.0",
"tslint": "~5.17.0",
"typescript": "3.4.5",
"webpack-cli": "^3.1.0"
  }
}

2 个答案:

答案 0 :(得分:4)

要解决此问题,请将其降级为“ 0.2.4”(删除插入号^符号)。

有关更多信息,请参见此thread

答案 1 :(得分:0)

我遇到了同样的问题,并通过更改buildOptimizer解决了这个问题:angular.json文件中的fale。

无需降级

只需更改

buildOptimizer: true

收件人

buildOptimizer: false

为我工作