简体   繁体   English

Webpack升级到Angular后报错10

[英]Webpack error after upgrading to Angular 10

I just performed an upgrade from Angular 6 to Angular 10 for our application.我刚刚为我们的应用程序执行了从 Angular 6 到 Angular 10 的升级。 I have gone through various component and module TypeScript files, and have fixed any imports that became outdated, and weren't mapping correctly.我浏览了各种组件和模块 TypeScript 文件,并修复了所有过时且未正确映射的导入。

I kept getting an error when I would run ng serve that would say the following:当我运行 ng serve 时,我一直收到错误消息,它会说以下内容:

ERROR in Cannot read property '0' of undefined

This would usually hang up in the terminal for a moment, then output file-specific errors underneath it.这通常会在终端中挂起片刻,然后在其下方出现 output 文件特定错误。

I would fix those errors.我会修复这些错误。 Once it quit giving me them, I still get the same above error, with nothing underneath it.一旦它不再给我它们,我仍然会遇到上述相同的错误,但下面没有任何内容。 Something I did notice is that most errors involve angular dependencies transitioning from em2015 to esm2015.我确实注意到,大多数错误都涉及 angular 从 em2015 转换到 esm2015 的依赖项。

I can run ng serve --verbose=true and get some additional output. It appears that something in webpack is hanging up the build process.我可以运行ng serve --verbose=true并获得一些额外的 output。看来 webpack 中的某些东西正在挂起构建过程。

I have experienced numerous problems with @angular/dev-kit before and thought I could be experiencing more.我之前遇到过很多@angular/dev-kit 的问题,我想我可能会遇到更多问题。 I went ahead and did a clean uninstall re-install.我继续进行干净的卸载并重新安装。 Nothing different.没什么不同。

When I upgraded all dependencies in the application, I uninstalled everything, deleted the node_modules folder, force cleaned cache, and reinstalled everything.当我升级应用程序中的所有依赖项时,我卸载了所有内容,删除了 node_modules 文件夹,强制清理缓存,然后重新安装了所有内容。

Does anyone have any idea of what can be causing webpack to fail?有谁知道是什么导致 webpack 失败? I have attached my package.json, and the output of ng serve --verbose=true .我附上了我的 package.json 和ng serve --verbose=true的 output。

{
  "name": "ng-cosm-crm",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@ag-grid-community/angular": "^23.2.1",
    "@ag-grid-enterprise/all-modules": "^23.2.1",
    "@angular-devkit/schematics": "^10.0.8",
    "@angular/animations": "^10.0.14",
    "@angular/cdk": "^10.1.3",
    "@angular/cli": "^10.0.8",
    "@angular/common": "^10.0.14",
    "@angular/compiler": "^10.0.14",
    "@angular/core": "^10.0.14",
    "@angular/forms": "^10.0.14",
    "@angular/material": "^10.1.3",
    "@angular/platform-browser": "^10.0.14",
    "@angular/platform-browser-dynamic": "^10.0.14",
    "@angular/platform-server": "^10.0.14",
    "@angular/router": "^10.0.14",
    "@angular/service-worker": "^10.0.14",
    "@fullcalendar/core": "^5.3.0",
    "accounting-js": "^1.1.1",
    "ag-grid": "^18.1.2",
    "ag-grid-angular": "^23.2.1",
    "ag-grid-community": "^23.2.1",
    "ag-grid-enterprise": "^23.2.1",
    "angular-2-local-storage": "^3.0.2",
    "angular-file-saver": "^1.1.3",
    "angular2-indexeddb": "^1.2.3",
    "angular2-logger": "^0.7.0",
    "angular2-multiselect-dropdown": "^4.6.3",
    "angular2-tinymce": "^3.3.0",
    "angular2-uuid": "^1.1.1",
    "barcode-scanner": "0.0.2",
    "blend4web": "^18.5.0",
    "bootstrap": "^4.5.2",
    "bootstrap-select": "^1.13.18",
    "chart.js": "^2.9.3",
    "core-js": "^3.6.5",
    "currency-formatter": "^1.5.6",
    "font-awesome": "^4.7.0",
    "hammerjs": "^2.0.8",
    "json-schema": "^0.2.5",
    "json-stringify-safe": "^5.0.1",
    "jspdf": "^2.1.0",
    "jspdf-autotable": "^3.5.9",
    "latest-version": "^5.1.0",
    "lodash.isequal": "^4.5.0",
    "mdbootstrap": "~4.19.1",
    "moment": "^2.27.0",
    "moment-timezone": "^0.5.31",
    "ng-connection-service": "^1.0.4",
    "ng2-cache": "^0.2.1",
    "ng2-carouselamos": "^4.1.0",
    "ng2-chosen": "0.0.2-beta5",
    "ng2-select": "^2.0.0",
    "ngx-device-detector": "2.0.0",
    "ngx-hm-carousel": "^1.7.2",
    "ngx-mask": "^10.0.1",
    "node-gyp": "^7.1.0",
    "pdfmake": "^0.1.68",
    "pngjs3": "^5.1.10",
    "primeng": "^9.1.3",
    "quagga": "^0.12.1",
    "quill": "^1.3.7",
    "resize-observer-polyfill": "^1.5.1",
    "rxjs": "6.6.2",
    "rxjs-compat": "6.6.2",
    "tinymce": "^5.4.2",
    "tslib": "^2.0.1",
    "userpilot": "^1.1.7",
    "xlsx": "^0.16.6",
    "zone.js": "~0.11.1"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.1000.8",
    "@angular/compiler-cli": "^10.0.14",
    "@types/jasmine": "3.5.14",
    "@types/node": "^14.6.1",
    "codelyzer": "^6.0.0",
    "jasmine-core": "~3.6.0",
    "jasmine-spec-reporter": "~5.0.2",
    "karma": "~5.1.1",
    "karma-chrome-launcher": "~3.1.0",
    "karma-cli": "~2.0.0",
    "karma-coverage-istanbul-reporter": "~3.0.3",
    "karma-jasmine": "~4.0.1",
    "karma-jasmine-html-reporter": "^1.5.4",
    "protractor": "~7.0.0",
    "ts-node": "~9.0.0",
    "tslint": "~6.1.3",
    "typescript": "^3.9.6",
    "webpack": "^4.44.1"
  }
}

I am running Node version 12.18.3 and NPM 6.14.6我正在运行节点版本 12.18.3 和 NPM 6.14.6

This upgrade problem was entirely to do with rxjs not upgrading correctly.这个升级问题完全是和rxjs没有正确升级有关。 Once it correctly updated, I was able to get actual errors and go through them one by one to actually get the app to serve.一旦它正确更新,我就能够通过它们一个一个地获得实际错误和 go 以实际获得应用程序服务。

Do not miss the RXJS step of the Angular upgrade if you are jumping from rxjs 5 to 6!如果你是从rxjs 5跳到6,不要错过Angular升级的RXJS步骤!

The biggest time consuming element of this upgrade was rxjs itself.这次升级最耗时的元素是 rxjs 本身。 For example going from .map().mergeMap().tap() to .pipe(map(), take()).subscribe() etc.例如从.map().mergeMap().tap().pipe(map(), take()).subscribe()等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从角度4升级到角度5后的Webpack错误 - Webpack error after upgrading from angular 4 to angular 5 升级到 Angular 10 后 VS 代码编辑器中的装饰器错误 - Decorators error in VS code editor after upgrading to Angular 10 升级到angular 5后,webpack命令失败 - After upgrading to angular 5 webpack command is failing 升级到webpack 4后,Angular Application中的InjectionToken Config否 - No for InjectionToken Config in Angular Application after upgrading to webpack 4 Angular 7-升级项目后出现错误 - Angular 7 - Error after upgrading a project 将 Angular 从 8 升级到 10 后,我在 ts.updateIdentifier is not a function 中遇到错误 - After Upgrading Angular from 8 to 10 I got ERROR in ts.updateIdentifier is not a function 在IE10中升级到Angular2 RC5后,没有提供PlatformRef错误的提供程序 - No provider for PlatformRef error after upgrading to Angular2 RC5 in IE10 Webpack Cypress 10 编译错误和 Angular 中的 Cucumber - Webpack Compilation Error with Cypress 10 and Cucumber in Angular Class 构造函数在升级到 Angular 10 后不能在没有“new”的情况下调用 - Class constructor cannot be invoked without 'new' after upgrading to Angular 10 升级到 Angular 10 后在单元测试中找不到库别名 - Fails to find library aliases in unit tests after upgrading to Angular 10
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM