webpack 在CI-CD azure devops中发布angular+.net核心项目时,无法读取未定义的属性'kind'

iq3niunx  于 2022-11-13  发布在  Webpack
关注(0)|答案(2)|浏览(148)

当在CI-CD步骤(发布)中运行ng build --prod命令时,我们收到以下错误。
模块生成失败(从
./node_modules/@angular-devkit/构建优化器/src/构建优化器/webpack-loader. js):TypeError:无法读取未定义的属性'kind'
这里是我的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"
  }
}
mwyxok5s

mwyxok5s1#

要解决此问题,请降级到“0.2.4”(删除^号)。
有关详细信息,请参阅此thread

6l7fqoea

6l7fqoea2#

我遇到了同样的问题,并通过更改buildOptimizer解决了该问题:angular.json文件中的错误。
不需要降级
“改变吧”

buildOptimizer: true

收件人

buildOptimizer: false

为我工作

相关问题