Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing to migrate from Angular v18 to v19 in monorepo #29798

Closed
1 of 4 tasks
joelcorrales opened this issue Jan 29, 2025 · 10 comments
Closed
1 of 4 tasks

Failing to migrate from Angular v18 to v19 in monorepo #29798

joelcorrales opened this issue Jan 29, 2025 · 10 comments
Assignees
Labels

Comments

@joelcorrales
Copy link

joelcorrales commented Jan 29, 2025

Current Behavior

After running the migration command, install deps and run the migrations in the json file, the migrations fails.

Expected Behavior

It should run the migrations and have the apps working with Angular@19

GitHub Repo

No response

Steps to Reproduce

  1. npx nx migrate latest
  2. pnpm install
  3. pnpm exec nx migrate --run-migrations

Nx Report

❯ npx nx report

 NX   Report complete - copy this into the issue template

Node           : 20.18.0
OS             : win32-x64
Native Target  : x86_64-windows
pnpm           : 9.12.2

nx                     : 20.4.0
@nx/js                 : 20.4.0
@nx/jest               : 20.4.0
@nx/eslint             : 20.4.0
@nx/workspace          : 20.4.0
@nx/angular            : 20.4.0
@nx/cypress            : 20.4.0
@nx/devkit             : 20.4.0
@nx/eslint-plugin      : 20.4.0
@nx/module-federation  : 20.4.0
@nx/web                : 20.4.0
@nx/webpack            : 20.4.0
typescript             : 5.7.3
---------------------------------------
Community plugins:
@ngrx/effects        : 19.0.0
@ngrx/operators      : 19.0.0
@ngrx/store          : 19.0.0
@ngrx/store-devtools : 19.0.0
ng-mocks             : 14.13.1

Failure Logs

❯ pnpm exec nx migrate --run-migrations --verbose

 NX   Running 'pnpm install --no-frozen-lockfile' to make sure necessary packages are installed

Scope: all 9 workspace projects
Lockfile is up to date, resolution step is skipped
Packages: +4 -4
++++----
Progress: resolved 4, reused 4, downloaded 0, added 0, done
. prepare$ husky
└─ Done in 133ms
Done in 2.6s

 NX   Running migrations from 'migrations.json'

Running the following migrations:
- @angular/cdk: migration-v19 (Updates the Angular CDK to v19)
- @angular/core: explicit-standalone-flag (Updates non-standalone Directives, Component and Pipes to 'standalone:false' and removes 'standalone:true' from those who are standalone)
- @angular/core: pending-tasks (Updates ExperimentalPendingTasks to PendingTasks)
- @angular/core: provide-initializer (Replaces `APP_INITIALIZER`, `ENVIRONMENT_INITIALIZER` & `PLATFORM_INITIALIZER` respectively with `provideAppInitializer`, `provideEnvironmentInitializer` & `providePlatformInitializer`.)
- @nx/angular: update-20-2-0-update-module-federation-config-import (Update the ModuleFederationConfig import use @nx/module-federation.)
- @nx/angular: update-20-2-0-update-with-module-federation-import (Update the withModuleFederation import use @nx/module-federation/angular.)
- @nx/eslint: update-typescript-eslint-v8.13.0 (Update TypeScript ESLint packages to v8.13.0 if they are already on v8)
- @nx/angular: update-angular-cli-version-19-0-0 (Update the @angular/cli package version to ~19.0.0.)
- @nx/angular: add-localize-polyfill-to-targets (Add the '@angular/localize/init' polyfill to the 'polyfills' option of targets using esbuild-based executors.)
- @nx/angular: update-angular-ssr-imports-to-use-node-entry-point (Update '@angular/ssr' import paths to use the new '/node' entry point when 'CommonEngine' is detected.)
- @nx/angular: disable-angular-eslint-prefer-standalone (Disable the Angular ESLint prefer-standalone rule if not set.)
- @nx/angular: remove-angular-eslint-rules (Remove Angular ESLint rules that were removed in v19.0.0.)
- @nx/angular: remove-tailwind-config-from-ng-packagr-executors (Remove the deprecated 'tailwindConfig' option from ng-packagr executors. Tailwind CSS configurations located at the project or workspace root will be picked up automatically.)
- @nx/eslint: add-file-extensions-to-overrides (Update ESLint flat config to include .cjs, .mjs, .cts, and .mts files in overrides (if needed))
- @nx/angular: ensure-nx-module-federation-package (If workspace includes Module Federation projects, ensure the new @nx/module-federation package is installed.)
- @nx/angular: update-angular-cli-version-19-1-0 (Update the @angular/cli package version to ~19.1.0.)
---------------------------------------------------------

Running migration @angular/cdk: migration-v19
    Skipping migration for project @lib/api. Unable to determine 'tsconfig.json' file in workspace config.
    Skipping migration for project @lib/core. Unable to determine 'tsconfig.json' file in workspace config.
    Skipping migration for project @lib/domain. Unable to determine 'tsconfig.json' file in workspace config.
    Skipping migration for project @lib/jsonforms. Unable to determine 'tsconfig.json' file in workspace config.
    Skipping migration for project @lib/login. Unable to determine 'tsconfig.json' file in workspace config.
    Skipping migration for project @lib/primeng. Unable to determine 'tsconfig.json' file in workspace config.
    Skipping migration for project @lib/swagger. Unable to determine 'tsconfig.json' file in workspace config.
    Skipping migration for project @lib/table-renderer. Unable to determine 'tsconfig.json' file in workspace config.

      ✓  Updated Angular CDK to version 19

Ran migration-v19 from @angular/cdk
  Updates the Angular CDK to v19

No changes were made

Running migration @angular/core: explicit-standalone-flag

 NX   Failed to run explicit-standalone-flag from @angular/core. This workspace is NOT up to date!


 NX   Cannot read properties of undefined (reading 'cli')

TypeError: Cannot read properties of undefined (reading 'cli')
    at isAngularMigration (C:\Super7UI\et-frontend\node_modules\.pnpm\n[email protected]_@[email protected]_@[email protected]_@[email protected]__@[email protected]_typ_lfxeik4fxrzotlcyiopa423qyi\node_modules\nx\src\command-line\migrate\migrate.js:1176:15)
    at executeMigrations (C:\Super7UI\et-frontend\node_modules\.pnpm\n[email protected]_@[email protected]_@[email protected]_@[email protected]__@[email protected]_typ_lfxeik4fxrzotlcyiopa423qyi\node_modules\nx\src\command-line\migrate\migrate.js:921:18)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async runMigrations (C:\Super7UI\et-frontend\node_modules\.pnpm\n[email protected]_@[email protected]_@[email protected]_@[email protected]__@[email protected]_typ_lfxeik4fxrzotlcyiopa423qyi\node_modules\nx\src\command-line\migrate\migrate.js:1010:37)
    at async C:\Super7UI\et-frontend\node_modules\.pnpm\n[email protected]_@[email protected]_@[email protected]_@[email protected]__@[email protected]_typ_lfxeik4fxrzotlcyiopa423qyi\node_modules\nx\src\command-line\migrate\migrate.js:1051:13
    at async handleErrors (C:\Super7UI\et-frontend\node_modules\.pnpm\n[email protected]_@[email protected]_@[email protected]_@[email protected]__@[email protected]_typ_lfxeik4fxrzotlcyiopa423qyi\node_modules\nx\src\utils\handle-errors.js:8:24)
    at async Object.handler (C:\Super7UI\et-frontend\node_modules\.pnpm\n[email protected]_@[email protected]_@[email protected]_@[email protected]__@[email protected]_typ_lfxeik4fxrzotlcyiopa423qyi\node_modules\nx\src\command-line\migrate\command-object.js:21:43)

nx migrate [packageAndVersion]

Creates a migrations file or runs migrations from the migrations file.
- Migrate packages and create migrations.json (e.g., nx migrate @nx/workspace@latest)
- Run migrations (e.g., nx migrate --run-migrations=migrations.json). Use flag --if-exists to run migrations only if the migrations file exists.

Positionals:
  packageAndVersion  The target package and version (e.g, @nx/[email protected]).                                                                    [string]

Options:
      --help                      Show help                                                                                                        [boolean]
      --version                   Show version number                                                                                              [boolean]
      --verbose                   Prints additional information about the commands (e.g., stack traces).                                           [boolean]
      --runMigrations             Execute migrations from a file (when the file isn't provided, execute migrations from migrations.json).           [string]
      --ifExists                  Run migrations only if the migrations file exists, if not continues successfully.               [boolean] [default: false]
      --from                      Use the provided versions for packages instead of the ones installed in node_modules (e.g.,
                                  --from="@nx/[email protected],@nx/[email protected]").                                                                         [string]
      --to                        Use the provided versions for packages instead of the ones calculated by the migrator (e.g.,
                                  --to="@nx/[email protected],@nx/[email protected]").                                                                           [string]
  -C, --createCommits             Automatically create a git commit after each migration runs.                                    [boolean] [default: false]
      --commitPrefix              Commit prefix to apply to the commit for each migration, when --create-commits is enabled.
                                                                                                                [string] [default: "chore: [nx migration] "]
      --interactive               Enable prompts to confirm whether to collect optional package updates and migrations.           [boolean] [default: false]
      --excludeAppliedMigrations  Exclude migrations that should have been applied on previous updates. To be used with --from.   [boolean] [default: false]

Examples:
  migrate latest                                                           Update all Nx plugins to "latest". This will generate migrations.json
  migrate 9.0.0                                                            Update all Nx plugins to "9.0.0". This will generate migrations.json
  migrate @nx/[email protected] --from="@nx/[email protected],@nx/[email protected]"  Update @nx/workspace and generate the list of migrations starting with version
                                                                           8.0.0 of @nx/workspace and @nx/node, regardless of what is installed locally
  migrate @nx/[email protected] --to="@nx/[email protected],@nx/[email protected]"     Update @nx/workspace to "9.0.0". If it tries to update @nx/react or @nx/angular,
                                                                           use version "9.0.1"
  migrate [email protected]                                           Update another-package to "12.0.0". This will update other packages and will
                                                                           generate migrations.json file
  migrate latest --interactive                                             Collect package updates and migrations in interactive mode. In this mode, the
                                                                           user will be prompted whether to apply any optional package update and migration
  migrate latest [email protected] --exclude-applied-migrations             Collect package updates and migrations starting with version 14.5.0 of "nx" (and
                                                                           Nx first-party plugins), regardless of what is installed locally, while excluding
                                                                           migrations that should have been applied on previous updates
  migrate --run-migrations=migrations.json                                 Run migrations from the provided migrations.json file. You can modify
                                                                           migrations.json and run this command many times
  migrate --run-migrations --create-commits                                Create a dedicated commit for each successfully completed migration. You can
                                                                           customize the prefix used for each commit by additionally setting
                                                                           --commit-prefix="PREFIX_HERE "

Find more information and examples at https://nx.dev/nx/migrate

Error: Command failed: pnpm exec nx _migrate --run-migrations --verbose
    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at checkExecSyncError (node:child_process:891:11)
    at execSync (node:child_process:963:15)
    at runNxSync (C:\Super7UI\et-frontend\node_modules\.pnpm\[email protected]_@[email protected]_@[email protected]_@[email protected]__@[email protected]_typ_lfxeik4fxrzotlcyiopa423qyi\node_modules\nx\src\utils\child-process.js:28:34)
    at runLocalMigrate (C:\Super7UI\et-frontend\node_modules\.pnpm\[email protected]_@[email protected]_@[email protected]_@[email protected]__@[email protected]_typ_lfxeik4fxrzotlcyiopa423qyi\node_modules\nx\src\command-line\migrate\migrate.js:1057:39)
    at Object.runMigration (C:\Super7UI\et-frontend\node_modules\.pnpm\[email protected]_@[email protected]_@[email protected]_@[email protected]__@[email protected]_typ_lfxeik4fxrzotlcyiopa423qyi\node_modules\nx\src\command-line\migrate\migrate.js:1080:9)
    at Object.handler (C:\Super7UI\et-frontend\node_modules\.pnpm\[email protected]_@[email protected]_@[email protected]_@[email protected]__@[email protected]_typ_lfxeik4fxrzotlcyiopa423qyi\node_modules\nx\src\command-line\migrate\command-object.js:13:68) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 7804,
  stdout: null,
  stderr: null
}

 NX   Command failed: pnpm exec nx migrate --run-migrations --verbose

Error: Command failed: pnpm exec nx migrate --run-migrations --verbose
    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at checkExecSyncError (node:child_process:891:11)
    at execSync (node:child_process:963:15)
    at runNxSync (C:\Users\USER~1\AppData\Local\Temp\tmp-24916-X7sEDKVpcNRZ\node_modules\.pnpm\[email protected]\node_modules\nx\src\utils\child-process.js:28:34)
    at runMigrations (C:\Users\USER~1\AppData\Local\Temp\tmp-24916-X7sEDKVpcNRZ\node_modules\.pnpm\[email protected]\node_modules\nx\src\command-line\migrate\migrate.js:985:39)
    at C:\Users\USER~1\AppData\Local\Temp\tmp-24916-X7sEDKVpcNRZ\node_modules\.pnpm\[email protected]\node_modules\nx\src\command-line\migrate\migrate.js:1051:19
    at async handleErrors (C:\Users\USER~1\AppData\Local\Temp\tmp-24916-X7sEDKVpcNRZ\node_modules\.pnpm\[email protected]\node_modules\nx\src\utils\handle-errors.js:8:24)

nx migrate [packageAndVersion]

Creates a migrations file or runs migrations from the migrations file.
- Migrate packages and create migrations.json (e.g., nx migrate @nx/workspace@latest)
- Run migrations (e.g., nx migrate --run-migrations=migrations.json). Use flag --if-exists to run migrations only if the migrations file exists.

Positionals:
  packageAndVersion  The target package and version (e.g, @nx/[email protected]).                                                                    [string]

Options:
      --help                      Show help                                                                                                        [boolean]
      --version                   Show version number                                                                                              [boolean]
      --verbose                   Prints additional information about the commands (e.g., stack traces).                                           [boolean]
      --runMigrations             Execute migrations from a file (when the file isn't provided, execute migrations from migrations.json).           [string]
      --ifExists                  Run migrations only if the migrations file exists, if not continues successfully.               [boolean] [default: false]
      --from                      Use the provided versions for packages instead of the ones installed in node_modules (e.g.,
                                  --from="@nx/[email protected],@nx/[email protected]").                                                                         [string]
      --to                        Use the provided versions for packages instead of the ones calculated by the migrator (e.g.,
                                  --to="@nx/[email protected],@nx/[email protected]").                                                                           [string]
  -C, --createCommits             Automatically create a git commit after each migration runs.                                    [boolean] [default: false]
      --commitPrefix              Commit prefix to apply to the commit for each migration, when --create-commits is enabled.
                                                                                                                [string] [default: "chore: [nx migration] "]
      --interactive               Enable prompts to confirm whether to collect optional package updates and migrations.           [boolean] [default: false]
      --excludeAppliedMigrations  Exclude migrations that should have been applied on previous updates. To be used with --from.   [boolean] [default: false]

Examples:
  migrate latest                                                           Update all Nx plugins to "latest". This will generate migrations.json
  migrate 9.0.0                                                            Update all Nx plugins to "9.0.0". This will generate migrations.json
  migrate @nx/[email protected] --from="@nx/[email protected],@nx/[email protected]"  Update @nx/workspace and generate the list of migrations starting with version
                                                                           8.0.0 of @nx/workspace and @nx/node, regardless of what is installed locally
  migrate @nx/[email protected] --to="@nx/[email protected],@nx/[email protected]"     Update @nx/workspace to "9.0.0". If it tries to update @nx/react or @nx/angular,
                                                                           use version "9.0.1"
  migrate [email protected]                                           Update another-package to "12.0.0". This will update other packages and will
                                                                           generate migrations.json file
  migrate latest --interactive                                             Collect package updates and migrations in interactive mode. In this mode, the
                                                                           user will be prompted whether to apply any optional package update and migration
  migrate latest [email protected] --exclude-applied-migrations             Collect package updates and migrations starting with version 14.5.0 of "nx" (and
                                                                           Nx first-party plugins), regardless of what is installed locally, while excluding
                                                                           migrations that should have been applied on previous updates
  migrate --run-migrations=migrations.json                                 Run migrations from the provided migrations.json file. You can modify
                                                                           migrations.json and run this command many times
  migrate --run-migrations --create-commits                                Create a dedicated commit for each successfully completed migration. You can
                                                                           customize the prefix used for each commit by additionally setting
                                                                           --commit-prefix="PREFIX_HERE "

Find more information and examples at https://nx.dev/nx/migrate

Error: Command failed: C:\Users\USER~1\AppData\Local\Temp\tmp-24916-X7sEDKVpcNRZ\node_modules\.bin\nx _migrate --run-migrations --verbose
    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at checkExecSyncError (node:child_process:891:11)
    at execSync (node:child_process:963:15)
    at Object.runMigration (C:\Super7UI\et-frontend\node_modules\.pnpm\n[email protected]_@[email protected]_@[email protected]_@[email protected]__@[email protected]_typ_lfxeik4fxrzotlcyiopa423qyi\node_modules\nx\src\command-line\migrate\migrate.js:1073:42)
    at Object.handler (C:\Super7UI\et-frontend\node_modules\.pnpm\n[email protected]_@[email protected]_@[email protected]_@[email protected]__@[email protected]_typ_lfxeik4fxrzotlcyiopa423qyi\node_modules\nx\src\command-line\migrate\command-object.js:13:68) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 24816,
  stdout: null,
  stderr: null
}

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

If it helps, here is the complete list of dependencies of the project

  "dependencies": {
    "@angular/animations": "19.1.3",
    "@angular/cdk": "19.1.1",
    "@angular/common": "19.1.3",
    "@angular/compiler": "19.1.3",
    "@angular/core": "19.1.3",
    "@angular/forms": "19.1.3",
    "@angular/platform-browser": "19.1.3",
    "@angular/platform-browser-dynamic": "19.1.3",
    "@angular/router": "19.1.3",
    "@babel/runtime": "7.24.1",
    "@fullcalendar/core": "6.1.15",
    "@fullcalendar/daygrid": "6.1.15",
    "@fullcalendar/interaction": "6.1.15",
    "@fullcalendar/timegrid": "6.1.15",
    "@happy-dom/jest-environment": "15.9.0",
    "@jsonforms/angular": "3.2.1",
    "@jsonforms/core": "3.2.1",
    "@ngrx/effects": "19.0.0",
    "@ngrx/operators": "19.0.0",
    "@ngrx/store": "19.0.0",
    "@ngrx/store-devtools": "19.0.0",
    "@stoplight/json-ref-resolver": "3.1.6",
    "ag-grid-angular": "32.3.2",
    "ag-grid-community": "32.3.2",
    "ag-grid-enterprise": "32.3.2",
    "ajv": "8.12.0",
    "ajv-errors": "3.0.0",
    "change-case": "5.4.4",
    "chart.js": "4.4.6",
    "core-js": "3.38.0",
    "globals": "15.12.0",
    "jest-auto-spies": "3.0.0",
    "jest-createspyobj": "2.0.0",
    "jose": "5.8.0",
    "js-yaml": "4.1.0",
    "json-refs": "3.0.15",
    "jsonpath": "1.1.1",
    "libphonenumber-js": "1.11.14",
    "luxon": "3.5.0",
    "luxon-business-days": "3.0.1",
    "monaco-editor": "0.50.0",
    "ng-mocks": "14.13.1",
    "ngx-infinite-scroll": "17.0.1",
    "ngx-monaco-editor": "12.0.0",
    "path": "0.12.7",
    "platform": "1.3.6",
    "primeicons": "7.0.0",
    "primeng": "17.18.11",
    "prismjs": "1.29.0",
    "quill": "2.0.2",
    "rxjs": "7.8.1",
    "swagger-ui-dist": "5.17.14",
    "tailwindcss": "3.4.13",
    "tslib": "2.6.2",
    "uuid": "10.0.0",
    "zone.js": "0.15.0"
  },
  "devDependencies": {
    "@angular-builders/jest": "18.0.0",
    "@angular-devkit/build-angular": "19.1.4",
    "@angular-devkit/core": "19.1.4",
    "@angular-devkit/schematics": "19.1.4",
    "@angular-eslint/eslint-plugin": "19.0.2",
    "@angular-eslint/eslint-plugin-template": "19.0.2",
    "@angular-eslint/template-parser": "19.0.2",
    "@angular/build": "19.1.4",
    "@angular/cli": "19.1.4",
    "@angular/compiler-cli": "19.1.3",
    "@angular/language-service": "19.1.3",
    "@commitlint/cli": "19.3.0",
    "@commitlint/config-conventional": "19.5.0",
    "@commitlint/prompt-cli": "19.5.0",
    "@nx/angular": "20.4.0",
    "@nx/cypress": "20.4.0",
    "@nx/eslint": "20.4.0",
    "@nx/eslint-plugin": "20.4.0",
    "@nx/jest": "20.4.0",
    "@nx/js": "20.4.0",
    "@nx/web": "20.4.0",
    "@nx/workspace": "20.4.0",
    "@schematics/angular": "19.1.4",
    "@swc-node/register": "1.9.1",
    "@swc/core": "1.5.7",
    "@swc/helpers": "0.5.11",
    "@types/jest": "29.5.13",
    "@types/luxon": "3.4.2",
    "@types/node": "22.9.0",
    "@types/uuid": "10.0.0",
    "@typescript-eslint/eslint-plugin": "7.18.0",
    "@typescript-eslint/parser": "7.13.1",
    "@typescript-eslint/utils": "7.16.0",
    "ajv-i18n": "4.2.0",
    "autoprefixer": "10.4.0",
    "cypress": "13.12.0",
    "eslint": "9.14.0",
    "eslint-config-prettier": "9.1.0",
    "eslint-config-standard": "17.1.0",
    "eslint-plugin-cypress": "3.5.0",
    "eslint-plugin-html": "8.1.1",
    "eslint-plugin-import": "2.29.1",
    "eslint-plugin-node": "11.1.0",
    "eslint-plugin-prettier": "5.2.1",
    "eslint-plugin-promise": "6.6.0",
    "eslint-plugin-unused-imports": "4.1.4",
    "fixpack": "4.0.0",
    "glob": "11.0.0",
    "happy-dom": "15.10.2",
    "husky": "9.1.6",
    "jest": "29.7.0",
    "jest-canvas-mock": "2.5.2",
    "jest-cli": "29.7.0",
    "jest-environment-jsdom": "29.7.0",
    "jest-preset-angular": "14.4.2",
    "jsonc-eslint-parser": "2.4.0",
    "lint-staged": "15.2.10",
    "lodash": "4.17.21",
    "ng-packagr": "19.1.2",
    "nx": "20.4.0",
    "postcss": "8.4.47",
    "postcss-import": "16.1.0",
    "postcss-preset-env": "9.6.0",
    "postcss-url": "10.1.3",
    "prettier": "3.3.3",
    "ts-jest": "29.2.5",
    "ts-node": "10.9.2",
    "tslib": "2.6.2",
    "typescript": "5.7.3",
    "typescript-eslint": "8.0.0"
  },
@isunilmekala
Copy link

isunilmekala commented Jan 30, 2025

For me specifically this migration step fails

{
"version": "19.0.0",
"factory": "./use-application-builder/migration",
"description": "Migrate application projects to the new build system. Application projects that are using the '@angular-devkit/build-angular' package's 'browser' and/or 'browser-esbuild' builders will be migrated to use the new 'application' builder. You can read more about this, including known issues and limitations, here: https://angular.dev/tools/cli/build-system-migration",
"optional": true,
"recommended": true,
"documentation": "tools/cli/build-system-migration",
"package": "@angular/cli",
"name": "use-application-builder"
},

Reason: Cannot update project "xxx" to use the application builder. Only "@angular-devkit/build-angular:browser-esbuild" and "@angular-devkit/build-angular:browser" can be automatically migrated.

My project contains MFE projects ( using webpack), is this the reason?

@FrozenPandaz FrozenPandaz added the scope: angular Issues related to Angular support in Nx label Jan 31, 2025
@leosvelperez
Copy link
Member

Thanks for reporting this!

@joelcorrales could you please share the migrations.json file that was generated by nx migrate latest?


@isunilmekala, your issue is unrelated. It's from an Angular CLI migration, which we don't control. It's not an error that blocks you since it doesn't error the migration. It continues to run all the migrations. That particular migration is meant to be an optional migration to convert your tasks to use the @angular/build:application builder. You can ignore the error and if you want to convert your tasks, you can try running the @nx/angular:convert-to-application-executor generator.

@joelcorrales
Copy link
Author

Thanks for reporting this!

@joelcorrales could you please share the migrations.json file that was generated by nx migrate latest?

@isunilmekala, your issue is unrelated. It's from an Angular CLI migration, which we don't control. It's not an error that blocks you since it doesn't error the migration. It continues to run all the migrations. That particular migration is meant to be an optional migration to convert your tasks to use the @angular/build:application builder. You can ignore the error and if you want to convert your tasks, you can try running the @nx/angular:convert-to-application-executor generator.

@leosvelperez sure! Here it is:

{
  "migrations": [
    {
      "version": "20.2.0-beta.5",
      "description": "Update TypeScript ESLint packages to v8.13.0 if they are already on v8",
      "implementation": "./src/migrations/update-20-2-0/update-typescript-eslint-v8-13-0",
      "package": "@nx/eslint",
      "name": "update-typescript-eslint-v8.13.0"
    },
    {
      "version": "20.3.0-beta.1",
      "description": "Update ESLint flat config to include .cjs, .mjs, .cts, and .mts files in overrides (if needed)",
      "implementation": "./src/migrations/update-20-3-0/add-file-extensions-to-overrides",
      "package": "@nx/eslint",
      "name": "add-file-extensions-to-overrides"
    },
    {
      "cli": "nx",
      "version": "20.2.0-beta.2",
      "description": "Update the ModuleFederationConfig import use @nx/module-federation.",
      "factory": "./src/migrations/update-20-2-0/migrate-mf-imports-to-new-package",
      "package": "@nx/angular",
      "name": "update-20-2-0-update-module-federation-config-import"
    },
    {
      "cli": "nx",
      "version": "20.2.0-beta.2",
      "description": "Update the withModuleFederation import use @nx/module-federation/angular.",
      "factory": "./src/migrations/update-20-2-0/migrate-with-mf-import-to-new-package",
      "package": "@nx/angular",
      "name": "update-20-2-0-update-with-module-federation-import"
    },
    {
      "cli": "nx",
      "version": "20.2.0-beta.5",
      "requires": { "@angular/core": ">=19.0.0" },
      "description": "Update the @angular/cli package version to ~19.0.0.",
      "factory": "./src/migrations/update-20-2-0/update-angular-cli",
      "package": "@nx/angular",
      "name": "update-angular-cli-version-19-0-0"
    },
    {
      "cli": "nx",
      "version": "20.2.0-beta.5",
      "requires": { "@angular/core": ">=19.0.0" },
      "description": "Add the '@angular/localize/init' polyfill to the 'polyfills' option of targets using esbuild-based executors.",
      "factory": "./src/migrations/update-20-2-0/add-localize-polyfill-to-targets",
      "package": "@nx/angular",
      "name": "add-localize-polyfill-to-targets"
    },
    {
      "cli": "nx",
      "version": "20.2.0-beta.5",
      "requires": { "@angular/core": ">=19.0.0" },
      "description": "Update '@angular/ssr' import paths to use the new '/node' entry point when 'CommonEngine' is detected.",
      "factory": "./src/migrations/update-20-2-0/update-angular-ssr-imports-to-use-node-entry-point",
      "package": "@nx/angular",
      "name": "update-angular-ssr-imports-to-use-node-entry-point"
    },
    {
      "cli": "nx",
      "version": "20.2.0-beta.6",
      "requires": { "@angular/core": ">=19.0.0" },
      "description": "Disable the Angular ESLint prefer-standalone rule if not set.",
      "factory": "./src/migrations/update-20-2-0/disable-angular-eslint-prefer-standalone",
      "package": "@nx/angular",
      "name": "disable-angular-eslint-prefer-standalone"
    },
    {
      "cli": "nx",
      "version": "20.2.0-beta.8",
      "requires": { "@angular/core": ">=19.0.0" },
      "description": "Remove Angular ESLint rules that were removed in v19.0.0.",
      "factory": "./src/migrations/update-20-2-0/remove-angular-eslint-rules",
      "package": "@nx/angular",
      "name": "remove-angular-eslint-rules"
    },
    {
      "cli": "nx",
      "version": "20.2.0-beta.8",
      "requires": { "@angular/core": ">=19.0.0" },
      "description": "Remove the deprecated 'tailwindConfig' option from ng-packagr executors. Tailwind CSS configurations located at the project or workspace root will be picked up automatically.",
      "factory": "./src/migrations/update-20-2-0/remove-tailwind-config-from-ng-packagr-executors",
      "package": "@nx/angular",
      "name": "remove-tailwind-config-from-ng-packagr-executors"
    },
    {
      "cli": "nx",
      "version": "20.3.0-beta.2",
      "description": "If workspace includes Module Federation projects, ensure the new @nx/module-federation package is installed.",
      "factory": "./src/migrations/update-20-3-0/ensure-nx-module-federation-package",
      "package": "@nx/angular",
      "name": "ensure-nx-module-federation-package"
    },
    {
      "cli": "nx",
      "version": "20.4.0-beta.1",
      "requires": { "@angular/core": ">=19.1.0" },
      "description": "Update the @angular/cli package version to ~19.1.0.",
      "factory": "./src/migrations/update-20-4-0/update-angular-cli",
      "package": "@nx/angular",
      "name": "update-angular-cli-version-19-1-0"
    },
    {
      "version": "19.0.0",
      "description": "Updates non-standalone Directives, Component and Pipes to 'standalone:false' and removes 'standalone:true' from those who are standalone",
      "factory": "./bundles/explicit-standalone-flag#migrate",
      "package": "@angular/core",
      "name": "explicit-standalone-flag"
    },
    {
      "version": "19.0.0",
      "description": "Updates ExperimentalPendingTasks to PendingTasks",
      "factory": "./bundles/pending-tasks#migrate",
      "package": "@angular/core",
      "name": "pending-tasks"
    },
    {
      "version": "19.0.0",
      "description": "Replaces `APP_INITIALIZER`, `ENVIRONMENT_INITIALIZER` & `PLATFORM_INITIALIZER` respectively with `provideAppInitializer`, `provideEnvironmentInitializer` & `providePlatformInitializer`.",
      "factory": "./bundles/provide-initializer#migrate",
      "optional": true,
      "package": "@angular/core",
      "name": "provide-initializer"
    },
    {
      "version": "19.0.0-0",
      "description": "Updates the Angular CDK to v19",
      "factory": "./ng-update/index#updateToV19",
      "package": "@angular/cdk",
      "name": "migration-v19"
    }
  ]
}

I also tried different approches, like incremental migration (19.8 - 20.0 - 20.1, etc) and it always fails in the same step

@leosvelperez
Copy link
Member

Weird. I can't reproduce the issue. From your error logs, it's throwing at https://github.com/nrwl/nx/blob/master/packages/nx/src/command-line/migrate/migrate.ts#L1814 when accessing entry.cli, but entry can only be undefined if schematics['explicit-standalone-flag'] doesn't exist in @angular/core/schematics/migrations.json, but it does: https://unpkg.com/@angular/[email protected]/schematics/migrations.json.

I'll need a repro so I can troubleshoot this further. If you can't provide one, you can try debugging this by running:

NX_MIGRATE_USE_LOCAL=true NX_MIGRATE_SKIP_INSTALL=true pnpm nx migrate --run-migrations

@joelcorrales
Copy link
Author

@leosvelperez I don't think I can provide one, I ran the command you pasted and this is the result:

> set NX_MIGRATE_USE_LOCAL=true&&set NX_MIGRATE_SKIP_INSTALL=true&&pnpm nx migrate --run-migrations


 NX   Running migrations from 'migrations.json'

Running the following migrations:
- @angular/cdk: migration-v19 (Updates the Angular CDK to v19)
- @angular/core: explicit-standalone-flag (Updates non-standalone Directives, Component and Pipes to 'standalone:false' and removes 'standalone:true' from those who are standalone)
- @angular/core: pending-tasks (Updates ExperimentalPendingTasks to PendingTasks)
- @angular/core: provide-initializer (Replaces `APP_INITIALIZER`, `ENVIRONMENT_INITIALIZER` & `PLATFORM_INITIALIZER` respectively with `provideAppInitializer`, `provideEnvironmentInitializer` & `providePlatformInitializer`.)
- @nx/angular: update-20-2-0-update-module-federation-config-import (Update the ModuleFederationConfig import use @nx/module-federation.)
- @nx/angular: update-20-2-0-update-with-module-federation-import (Update the withModuleFederation import use @nx/module-federation/angular.)
- @nx/eslint: update-typescript-eslint-v8.13.0 (Update TypeScript ESLint packages to v8.13.0 if they are already on v8)
- @nx/angular: update-angular-cli-version-19-0-0 (Update the @angular/cli package version to ~19.0.0.)
- @nx/angular: add-localize-polyfill-to-targets (Add the '@angular/localize/init' polyfill to the 'polyfills' option of targets using esbuild-based executors.)
- @nx/angular: update-angular-ssr-imports-to-use-node-entry-point (Update '@angular/ssr' import paths to use the new '/node' entry point when 'CommonEngine' is detected.)
- @nx/angular: disable-angular-eslint-prefer-standalone (Disable the Angular ESLint prefer-standalone rule if not set.)
- @nx/angular: remove-angular-eslint-rules (Remove Angular ESLint rules that were removed in v19.0.0.)
- @nx/angular: remove-tailwind-config-from-ng-packagr-executors (Remove the deprecated 'tailwindConfig' option from ng-packagr executors. Tailwind CSS configurations located at the project or workspace root will be picked up automatically.)
- @nx/eslint: add-file-extensions-to-overrides (Update ESLint flat config to include .cjs, .mjs, .cts, and .mts files in overrides (if needed))
- @nx/angular: ensure-nx-module-federation-package (If workspace includes Module Federation projects, ensure the new @nx/module-federation package is installed.)
- @nx/angular: update-angular-cli-version-19-1-0 (Update the @angular/cli package version to ~19.1.0.)
---------------------------------------------------------

Running migration @angular/cdk: migration-v19
    Skipping migration for project @lib/api. Unable to determine 'tsconfig.json' file in workspace config.
    Skipping migration for project @lib/core. Unable to determine 'tsconfig.json' file in workspace config.
    Skipping migration for project @lib/domain. Unable to determine 'tsconfig.json' file in workspace config.
    Skipping migration for project @lib/jsonforms. Unable to determine 'tsconfig.json' file in workspace config.
    Skipping migration for project @lib/login. Unable to determine 'tsconfig.json' file in workspace config.
    Skipping migration for project @lib/ngrx. Unable to determine 'tsconfig.json' file in workspace config.
    Skipping migration for project @lib/primeng. Unable to determine 'tsconfig.json' file in workspace config.
    Skipping migration for project @lib/swagger. Unable to determine 'tsconfig.json' file in workspace config.
    Skipping migration for project @lib/table-renderer. Unable to determine 'tsconfig.json' file in workspace config.

      ✓  Updated Angular CDK to version 19

Ran migration-v19 from @angular/cdk
  Updates the Angular CDK to v19

No changes were made

Running migration @angular/core: explicit-standalone-flag

 NX   Failed to run explicit-standalone-flag from @angular/core. This workspace is NOT up to date!


 NX   Cannot read properties of undefined (reading 'cli')

Pass --verbose to see the stacktrace.

nx migrate [packageAndVersion]

Creates a migrations file or runs migrations from the migrations file.
- Migrate packages and create migrations.json (e.g., nx migrate @nx/workspace@latest)
- Run migrations (e.g., nx migrate --run-migrations=migrations.json). Use flag --if-exists to run migrations only if the migrations file exists.

Positionals:
  packageAndVersion  The target package and version (e.g, @nx/[email protected]).                                                                    [string]

Options:
      --help                      Show help                                                                                                        [boolean]
      --version                   Show version number                                                                                              [boolean]
      --verbose                   Prints additional information about the commands (e.g., stack traces).                                           [boolean]
      --runMigrations             Execute migrations from a file (when the file isn't provided, execute migrations from migrations.json).           [string]
      --ifExists                  Run migrations only if the migrations file exists, if not continues successfully.               [boolean] [default: false]
      --from                      Use the provided versions for packages instead of the ones installed in node_modules (e.g.,
                                  --from="@nx/[email protected],@nx/[email protected]").                                                                         [string]
      --to                        Use the provided versions for packages instead of the ones calculated by the migrator (e.g.,
                                  --to="@nx/[email protected],@nx/[email protected]").                                                                           [string]
  -C, --createCommits             Automatically create a git commit after each migration runs.                                    [boolean] [default: false]
      --commitPrefix              Commit prefix to apply to the commit for each migration, when --create-commits is enabled.
                                                                                                                [string] [default: "chore: [nx migration] "]
      --interactive               Enable prompts to confirm whether to collect optional package updates and migrations.           [boolean] [default: false]
      --excludeAppliedMigrations  Exclude migrations that should have been applied on previous updates. To be used with --from.   [boolean] [default: false]

Examples:
  migrate latest                                                           Update all Nx plugins to "latest". This will generate migrations.json
  migrate 9.0.0                                                            Update all Nx plugins to "9.0.0". This will generate migrations.json
  migrate @nx/[email protected] --from="@nx/[email protected],@nx/[email protected]"  Update @nx/workspace and generate the list of migrations starting with version
                                                                           8.0.0 of @nx/workspace and @nx/node, regardless of what is installed locally
  migrate @nx/[email protected] --to="@nx/[email protected],@nx/[email protected]"     Update @nx/workspace to "9.0.0". If it tries to update @nx/react or @nx/angular,
                                                                           use version "9.0.1"
  migrate [email protected]                                           Update another-package to "12.0.0". This will update other packages and will
                                                                           generate migrations.json file
  migrate latest --interactive                                             Collect package updates and migrations in interactive mode. In this mode, the
                                                                           user will be prompted whether to apply any optional package update and migration
  migrate latest [email protected] --exclude-applied-migrations             Collect package updates and migrations starting with version 14.5.0 of "nx" (and
                                                                           Nx first-party plugins), regardless of what is installed locally, while excluding
                                                                           migrations that should have been applied on previous updates
  migrate --run-migrations=migrations.json                                 Run migrations from the provided migrations.json file. You can modify
                                                                           migrations.json and run this command many times
  migrate --run-migrations --create-commits                                Create a dedicated commit for each successfully completed migration. You can
                                                                           customize the prefix used for each commit by additionally setting
                                                                           --commit-prefix="PREFIX_HERE "

Find more information and examples at https://nx.dev/nx/migrate

Error: Command failed: pnpm exec nx _migrate --run-migrations
    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at checkExecSyncError (node:child_process:891:11)
    at execSync (node:child_process:963:15)
    at runNxSync (C:\project\et-frontend\node_modules\.pnpm\[email protected]_@[email protected]_@[email protected]_@[email protected]__@[email protected]_typ_lfxeik4fxrzotlcyiopa423qyi\node_modules\nx\src\utils\child-process.js:28:34)
    at runLocalMigrate (C:\project\et-frontend\node_modules\.pnpm\[email protected]_@[email protected]_@[email protected]_@[email protected]__@[email protected]_typ_lfxeik4fxrzotlcyiopa423qyi\node_modules\nx\src\command-line\migrate\migrate.js:1057:39)
    at Object.runMigration (C:\project\et-frontend\node_modules\.pnpm\[email protected]_@[email protected]_@[email protected]_@[email protected]__@[email protected]_typ_lfxeik4fxrzotlcyiopa423qyi\node_modules\nx\src\command-line\migrate\migrate.js:1080:9)
    at Object.handler (C:\project\et-frontend\node_modules\.pnpm\[email protected]_@[email protected]_@[email protected]_@[email protected]__@[email protected]_typ_lfxeik4fxrzotlcyiopa423qyi\node_modules\nx\src\command-line\migrate\command-object.js:13:68) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 22436,
  stdout: null,
  stderr: null
}

Does it make a difference that is a monorepo with several libs and apps?

@leosvelperez
Copy link
Member

I suggested that command so you could set some breakpoints in your node_modules and debug the issue. Unfortunately, I can't reproduce the issue with the information provided. As explained in my previous comment, I can't imagine either how it can happen.

Does it make a difference that is a monorepo with several libs and apps?

It doesn't. The failure is unrelated to the amount of projects or the structure of your workspace.

I guess we can try to check one more thing. Can you paste the contents of the files node_modules/@angular/core/package.json and node_modules/@angular/core/schematics/migrations.json. Make sure you get the contents of those files after you ran nx migrate latest and pnpm install.

@joelcorrales
Copy link
Author

@leosvelperez sure, this is the @angular/core/package.js

{
  "name": "@angular/core",
  "version": "18.2.8",
  "description": "Angular - the core framework",
  "author": "angular",
  "license": "MIT",
  "engines": {
    "node": "^18.19.1 || ^20.11.1 || >=22.0.0"
  },
  "exports": {
    "./schematics/*": {
      "default": "./schematics/*.js"
    },
    "./event-dispatch-contract.min.js": {
      "default": "./event-dispatch-contract.min.js"
    },
    "./package.json": {
      "default": "./package.json"
    },
    ".": {
      "types": "./index.d.ts",
      "esm2022": "./esm2022/core.mjs",
      "esm": "./esm2022/core.mjs",
      "default": "./fesm2022/core.mjs"
    },
    "./primitives/event-dispatch": {
      "types": "./primitives/event-dispatch/index.d.ts",
      "esm2022": "./esm2022/primitives/event-dispatch/index.mjs",
      "esm": "./esm2022/primitives/event-dispatch/index.mjs",
      "default": "./fesm2022/primitives/event-dispatch.mjs"
    },
    "./primitives/signals": {
      "types": "./primitives/signals/index.d.ts",
      "esm2022": "./esm2022/primitives/signals/index.mjs",
      "esm": "./esm2022/primitives/signals/index.mjs",
      "default": "./fesm2022/primitives/signals.mjs"
    },
    "./rxjs-interop": {
      "types": "./rxjs-interop/index.d.ts",
      "esm2022": "./esm2022/rxjs-interop/rxjs-interop.mjs",
      "esm": "./esm2022/rxjs-interop/rxjs-interop.mjs",
      "default": "./fesm2022/rxjs-interop.mjs"
    },
    "./testing": {
      "types": "./testing/index.d.ts",
      "esm2022": "./esm2022/testing/testing.mjs",
      "esm": "./esm2022/testing/testing.mjs",
      "default": "./fesm2022/testing.mjs"
    }
  },
  "dependencies": {
    "tslib": "^2.3.0"
  },
  "peerDependencies": {
    "rxjs": "^6.5.3 || ^7.4.0",
    "zone.js": "~0.14.10"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/angular/angular.git",
    "directory": "packages/core"
  },
  "ng-update": {
    "migrations": "./schematics/migrations.json",
    "packageGroup": [
      "@angular/core",
      "@angular/bazel",
      "@angular/common",
      "@angular/compiler",
      "@angular/compiler-cli",
      "@angular/animations",
      "@angular/elements",
      "@angular/platform-browser",
      "@angular/platform-browser-dynamic",
      "@angular/forms",
      "@angular/platform-server",
      "@angular/upgrade",
      "@angular/router",
      "@angular/language-service",
      "@angular/localize",
      "@angular/service-worker"
    ]
  },
  "schematics": "./schematics/collection.json",
  "sideEffects": false,
  "module": "./fesm2022/core.mjs",
  "typings": "./index.d.ts",
  "type": "module"
}

and here @angular/core/schematics/migrations.json

{
  "schematics": {
    "invalid-two-way-bindings": {
      "version": "18.0.0",
      "description": "Updates two-way bindings that have an invalid expression to use the longform expression instead.",
      "factory": "./migrations/invalid-two-way-bindings/bundle"
    },
    "migration-http-providers": {
      "version": "18.0.0",
      "description": "Replace deprecated HTTP related modules with provider functions",
      "factory": "./migrations/http-providers/bundle"
    },
    "migration-after-render-phase": {
      "version": "18.1.0",
      "description": "Updates calls to afterRender with an explicit phase to the new API",
      "factory": "./migrations/after-render-phase/bundle"
    }
  }
}

@leosvelperez
Copy link
Member

Is that what you have in node_modules after running nx migrate latest and pnpm install? You should have @angular/core v19 and not v18.2.8. The nx migrate latest should have bumped that package version to v19.

What version of the package do you have in your repo's root package.json file?

@joelcorrales
Copy link
Author

@leosvelperez I notice that, yes that's the version inside the node_modules, that let me know that something was wrong with the install, the deps were updated correctly but I had a overrides in the main package.json to prevent the libs to use a different @angular/core and @angular/common and that was not updated, once I updated that manually, everything worked fine! Thanks! Closing this issue.

Copy link

github-actions bot commented Mar 8, 2025

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 8, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants