angular - ng build --prod Angular 中的 ./node_modules/ng2-material-dropdown/fesm5/ng2-material-dropdown.js 中的错误
问题描述
无法在 ng build --prod 上构建 Angular 项目
ERROR in ./node_modules/ng2-material-dropdown/fesm5/ng2-material-dropdown.js Module build failed (from ./node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js): TypeError: Cannot read property 'kind' of undefined at isAngularDecoratorMetadataExpression (C:\SKUnest Projects\hub-dashboard-publish\SKUnestClientApp\node_modules\@angular-devkit\build-optimizer\src\transforms\scrub-file.js:265:35) at checkNodeForDecorators (C:\SKUnest Projects\hub-dashboard-publish\SKUnestClientApp\node_modules\@angular-devkit\build-optimizer\src\transforms\scrub-file.js:77:21) at visitNodes (C:\SKUnest Projects\hub-dashboard-publish\SKUnestClientApp\node_modules\@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:16144:30) at Object.forEachChild (C:\SKUnest Projects\hub-dashboard-publish\SKUnestClientApp\node_modules\@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:16370:24) at checkNodeForDecorators (C:\SKUnest Projects\hub-dashboard-publish\SKUnestClientApp\node_modules\@angular-devkit\build-optimizer\src\transforms\scrub-file.js:68:31) at visitNode (C:\SKUnest Projects\hub-dashboard-publish\SKUnestClientApp\node_modules\@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:16135:24) at Object.forEachChild (C:\SKUnest Projects\hub-dashboard-publish\SKUnestClientApp\node_modules\@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:16265:21) at checkNodeForDecorators (C:\SKUnest Projects\hub-dashboard-publish\SKUnestClientApp\node_modules\@angular-devkit\build-optimizer\src\transforms\scrub-file.js:68:31) at visitNode (C:\SKUnest Projects\hub-dashboard-publish\SKUnestClientApp\node_modules\@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:16135:24) at Object.forEachChild (C:\SKUnest Projects\hub-dashboard-publish\SKUnestClientApp\node_modules\@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:16322:24) at checkNodeForDecorators (C:\SKUnest Projects\hub-dashboard-publish\SKUnestClientApp\node_modules\@angular-devkit\build-optimizer\src\transforms\scrub-file.js:68:31) at visitNode (C:\SKUnest Projects\hub-dashboard-publish\SKUnestClientApp\node_modules\@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:16135:24) at Object.forEachChild (C:\SKUnest Projects\hub-dashboard-publish\SKUnestClientApp\node_modules\@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:16333:24) at checkNodeForDecorators (C:\SKUnest Projects\hub-dashboard-publish\SKUnestClientApp\node_modules\@angular-devkit\build-optimizer\src\transforms\scrub-file.js:68:31) at visitNode (C:\SKUnest Projects\hub-dashboard-publish\SKUnestClientApp\node_modules\@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:16135:24) at Object.forEachChild (C:\SKUnest Projects\hub-dashboard-publish\SKUnestClientApp\node_modules\@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:16229:21) at checkNodeForDecorators (C:\SKUnest Projects\hub-dashboard-publish\SKUnestClientApp\node_modules\@angular-devkit\build-optimizer\src\transforms\scrub-file.js:68:31) at visitNodes (C:\SKUnest Projects\hub-dashboard-publish\SKUnestClientApp\node_modules\@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:16144:30) at Object.forEachChild (C:\SKUnest Projects\hub-dashboard-publish\SKUnestClientApp\node_modules\@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:16379:24) at checkNodeForDecorators (C:\SKUnest Projects\hub-dashboard-publish\SKUnestClientApp\node_modules\@angular-devkit\build-optimizer\src\transforms\scrub-file.js:68:31) at visitNode (C:\SKUnest Projects\hub-dashboard-publish\SKUnestClientApp\node_modules\@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:16135:24) at Object.forEachChild (C:\SKUnest Projects\hub-dashboard-publish\SKUnestClientApp\node_modules\@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:16377:21) at checkNodeForDecorators (C:\SKUnest Projects\hub-dashboard-publish\SKUnestClientApp\node_modules\@angular-devkit\build-optimizer\src\transforms\scrub-file.js:68:31) at visitNodes (C:\SKUnest Projects\hub-dashboard-publish\SKUnestClientApp\node_modules\@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:16144:30) at Object.forEachChild (C:\SKUnest Projects\hub-dashboard-publish\SKUnestClientApp\node_modules\@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:16372:24) at transformer (C:\SKUnest Projects\hub-dashboard-publish\SKUnestClientApp\node_modules\@angular-devkit\build-optimizer\src\transforms\scrub-file.js:63:16) at C:\SKUnest Projects\hub-dashboard-publish\SKUnestClientApp\node_modules\@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:1390:86 at reduceLeft (C:\SKUnest Projects\hub-dashboard-publish\SKUnestClientApp\node_modules\@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:1102:30)
包.json 文件
{ "name": "TestAngular", "version": "0.0.0", "license": "MIT", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "build:ssr": "npm run build -- --app=ssr --output-hashing=media", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e", "build-prod": "node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng build --prod" }, "private": true, "dependencies": { "@analytics/google-analytics": "^0.5.2", "@angular/animations": "^7.2.16", "@angular/cdk": "^7.3.7", "@angular/common": "^7.2.16", "@angular/compiler": "^7.2.16", "@angular/core": "^7.2.16", "@angular/forms": "^7.2.16", "@angular/http": "^7.2.16", "@angular/platform-browser": "^7.2.16", "@angular/platform-browser-dynamic": "^7.2.16", "@angular/platform-server": "^7.2.16", "@angular/router": "^7.2.16", "@ckeditor/ckeditor5-angular": "^1.2.3", "@hardpool/ngx-spinner": "^2.2.1", "@ng-bootstrap/ng-bootstrap": "^4.2.2", "@ng-select/ng-select": "^2.20.5", "@nguniversal/module-map-ngfactory-loader": "^7.1.1", "@ngx-lite/input-tag": "^0.2.8", "@types/jquery": "^3.5.5", "@types/mocha": "^5.2.7", "@wkoza/ngx-upload": "^6.4.0", "ajv": "^6.12.6", "analytics": "^0.5.5", "ang-jsoneditor": "1.7.4", "angular-cropperjs": "^1.0.2", "angular-sortablejs": "^2.7.0", "angular-web-storage": "^4.1.0", "angular2-csv": "^0.2.9", "angular5-csv": "^0.2.11", "aspnet-prerendering": "^3.0.1", "auth0-js": "^9.14.0", "aws-rxjs": "^0.2.2", "aws-sdk": "^2.810.0", "aws4": "^1.11.0", "axios": "^0.18.0", "bigint-as-any-ts": "^1.0.2", "bootstrap": "^4.5.3", "bootstrap-datetime-picker": "2.4.4", "bootstrap-select": "1.13.5", "buffer": "^5.7.1", "chart.js": "^2.9.4", "color-hash": "^1.0.3", "core-js": "^2.6.12", "cropperjs": "1.4.3", "es6-promisify": "^6.1.1", "exceljs": "^1.15.0", "export-to-csv": "^0.2.1", "file-saver": "^2.0.5", "font-awesome": "^4.7.0", "gojs": "^2.1.31", "gojs-angular": "^1.0.14", "hammerjs": "^2.0.8", "html2canvas": "^1.0.0-rc.7", "intro.js": "^2.9.3", "intro.js-verso": "^2.9.8", "jquery": "^3.5.1", "jsencrypt": "2.3.1", "jsoneditor": "^8.6.8", "jspdf": "^2.2.0", "keen-tracking": "^4.5.1", "list.js": "^1.5.0", "moment": "^2.29.1", "ng-pick-datetime": "^7.0.0", "ng-pick-datetime-moment": "1.0.8", "ng2-charts": "^2.2.3", "ng2-currency-mask": "^5.3.1", "ngx-chips": "2.1.0", "ngx-file-drop": "^5.1.0", "ngx-gallery": "^5.10.0", "ngx-input-tag": "0.0.5", "ngx-malihu-scrollbar": "^7.0.0", "ngx-mask": "^7.9.10", "ngx-pagination": "^3.3.1", "ngx-slick-carousel": "^0.4.7", "ngx-spinner": "^6.1.2", "ngx-toastr": "^10.0.4", "ngx-ui-loader": "^7.2.2", "ngx-ui-switch": "^8.3.0", "ngxf-uploader": "^1.6.0", "pdfmake": "^0.1.68", "popper.js": "^1.16.1", "request": "^2.88.2", "rxjs": "^6.6.3", "slick-carousel": "^1.8.1", "sortablejs": "^1.12.0", "url": "^0.11.0", "xlsx": "^0.14.5", "zone.js": "^0.8.29" }, "devDependencies": { "@angular-devkit/build-angular": "^0.12.1", "@angular/cli": "^7.3.10", "@angular/compiler-cli": "^7.2.16", "@angular/language-service": "^7.2.16", "@types/jasmine": "^3.3.16", "@types/jasminewd2": "^2.0.8", "@types/node": "^10.17.49", "codelyzer": "^4.5.0", "jasmine-core": "~3.3.0", "jasmine-spec-reporter": "~4.2.1", "karma": "~3.1.4", "karma-chrome-launcher": "~2.2.0", "karma-coverage-istanbul-reporter": "^2.1.1", "karma-jasmine": "~2.0.1", "karma-jasmine-html-reporter": "^1.5.4", "ng2-charts-schematics": "^0.1.7", "protractor": "^5.4.4", "ts-node": "~7.0.1", "tslint": "^5.12.1", "typescript": "3.1.6", "webpack-cli": "^3.3.12" }, "optionalDependencies": { "node-sass": "4.11.0" } }
解决方案
无法读取未定义的 scrub-file.js:265:35 的属性“种类”
推荐阅读
- amazon-web-services - 通过 AWS 上的 Tibanna 执行 Snakemake 工作流程
- ssis - SSIS 集成运行时 ADF - 为 Visual FoxPro 9.0 安装 Microsoft OLE DB 提供程序
- ios - iOS:NSPredicate 使用存储为字符串的日期进行比较
- excel - 如果行号包含在集合中,一种删除行的方法?
- android - 应用未运行时在 Android 手机上接收 FCM 数据通知
- kubernetes - Kubeflow-kale :- 如何集成 kubeflow-kale 扩展以在单独的 Kubeflow 管道集群上运行管道
- python - 将 pygame 和 tkinter 转换为 exe
- c# - 如何解决“现有连接被远程主机强行关闭”查询?
- php - 覆盖 .htaccess 时永久链接不起作用
- jwt - Ejabberd 中的 JWT 身份验证