nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.69k stars 2.36k forks source link

Getting error while trying to migrate to Angular 9 #3595

Closed mohijalili closed 3 years ago

mohijalili commented 4 years ago

Current Behavior

Executing 'migration-v9-undecorated-classes-with-di' of package '@angular/core'

Expected Behavior

Updating Nx following https://nx.dev/angular/guides/update guide goes without errors.

Steps to Reproduce

Failure Logs

 ng update @angular/core --migrate-only migration-v9-undecorated-classes-with-di
The installed Angular CLI version is older than the latest stable version.
Installing a temporary version to perform the update.
Installing packages for tooling via npm.
Installed packages for tooling via npm.
Using package manager: 'npm'
Collecting installed dependencies...
Found 61 dependencies.
** Executing 'migration-v9-undecorated-classes-with-di' of package '@angular/core' **

❯ Undecorated classes with DI migration.
  As of Angular 9, it is no longer supported to use Angular DI on a class that does not have an Angular decorator.
  Read more about this here: https://v9.angular.io/guide/migration-undecorated-classes

This migration uses the Angular compiler internally and therefore projects that no longer
build successfully after the update cannot run the migration.
Please ensure there are no AOT compilation errors and rerun the migration. The following project failed: libs/core/tsconfig.lib.json

    Error: ~/libs/core/src/lib/core.module.ts:159:1: Error encountered in metadata generated for exported symbol 'CoreModule':
    ~/libs/core/src/lib/core.module.ts:46:23: Metadata collected contains an error that will be reported at runtime: Lambda not supported.
      {"__symbolic":"error","message":"Lambda not supported","line":45,"character":22}

    Could not migrate all undecorated classes that use dependency
    injection. Some project targets could not be analyzed due to
    TypeScript program failures.

    Migration can be rerun with: "ng update @angular/core --migrate-only migration-v9-undecorated-classes-with-di"

  Migration completed

Environment

  "dependencies": {
    "@agm/core": "^1.1.0",
    "@angular/animations": "^8.2.14",
    "@angular/cdk": "^8.2.3",
    "@angular/common": "^8.2.14",
    "@angular/compiler": "^8.2.14",
    "@angular/core": "^8.2.14",
    "@angular/fire": "^5.3.0",
    "@angular/flex-layout": "^8.0.0-beta.27",
    "@angular/forms": "^8.2.14",
    "@angular/material": "^8.2.3",
    "@angular/material-moment-adapter": "^8.2.3",
    "@angular/platform-browser": "^8.2.14",
    "@angular/platform-browser-dynamic": "^8.2.14",
    "@angular/pwa": "^0.901.3",
    "@angular/router": "^8.2.14",
    "@angular/service-worker": "^8.2.14",
    "@auth0/angular-jwt": "^3.0.1",
    "@ngrx/data": "^8.6.0",
    "@ngrx/effects": "^8.6.0",
    "@ngrx/entity": "^8.6.0",
    "@ngrx/router-store": "^8.6.0",
    "@ngrx/store": "^8.6.0",
    "@ngrx/store-devtools": "^8.6.0",
    "@nrwl/angular": "8.12.11",
    "@syncfusion/ej2-angular-popups": "^18.2.44",
    "@syncfusion/ej2-angular-richtexteditor": "^18.2.44",
    "angular-plotly.js": "^1.8.0",
    "core-js": "^2.6.11",
    "firebase": "^6.6.2",
    "font-awesome": "^4.7.0",
    "hammerjs": "^2.0.8",
    "ngx-bootstrap": "^5.3.2",
    "ngx-color-picker": "^9.1.0",
    "ngx-device-detector": "^1.3.20",
    "rxjs": "^6.5.4",
    "tslib": "^1.9.0",
    "zone.js": "^0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.803.29",
    "@angular-devkit/build-ng-packagr": "0.803.23",
    "@angular/cli": "8.3.23",
    "@angular/compiler-cli": "^8.2.14",
    "@angular/language-service": "^8.2.14",
    "@ngrx/schematics": "^8.6.0",
    "@ngrx/store-devtools": "8.6.0",
    "@nrwl/cypress": "8.12.11",
    "@nrwl/jest": "8.12.11",
    "@nrwl/workspace": "8.12.11",
    "@types/googlemaps": "^3.39.1",
    "@types/jest": "^24.0.9",
    "@types/node": "~8.9.4",
    "codelyzer": "~5.0.1",
    "cypress": "3.8.3",
    "dotenv": "6.2.0",
    "jest": "^24.1.0",
    "jest-preset-angular": "^8.2.1",
    "ng-packagr": "^5.7.1",
    "prettier": "1.16.4",
    "ts-jest": "^26.2.0",
    "ts-node": "~7.0.0",
    "tsickle": "^0.38.1",
    "tslint": "~5.11.0",
    "typescript": "~3.5.3"
  }
philipjfulcher commented 3 years ago

@mohijalili I was able to migrate an Nx workspace from 8 to 9 with no problem just now. From that error message, I suspect you have an issue in your code related to Angular 9 compilation. These other issues may help point you in the right direction: https://github.com/ng-packagr/ng-packagr/issues/696 https://github.com/angular/angular/issues/23629

If that doesn't help and you're still having this issue, can you provide a repro?

philipjfulcher commented 3 years ago

I'm going to close this issue, feel free to re-open if you still have a problem and can produce a repro.

github-actions[bot] commented 1 year ago

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.