Skip to content

Commit 8c1ef45

Browse files
committed
fix(@angular/cli): skip CLI version check for migrate-only updates
When running `ng update @angular/cli --name=use-application-builder`, the CLI would fetch and install the latest version (e.g., v20) as a temporary CLI to perform the update, even though migrate-only mode operates on the currently installed package version. This caused incompatible packages to be installed (e.g., @angular/build@20 on an Angular 18/19 project). The fix skips the CLI version check when in migrate-only mode (--name or --migrate-only), since migrations run against the installed version and don't need a different CLI version. Closes #30696
1 parent c7eb5e7 commit 8c1ef45

File tree

1 file changed

+3
-1
lines changed
  • packages/angular/cli/src/commands/update

1 file changed

+3
-1
lines changed

packages/angular/cli/src/commands/update/cli.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,9 @@ export default class UpdateCommandModule extends CommandModule<UpdateCommandArgs
167167

168168
// Check if the current installed CLI version is older than the latest compatible version.
169169
// Skip when running `ng update` without a package name as this will not trigger an actual update.
170-
if (!disableVersionCheck && options.packages?.length) {
170+
// Also skip when using migrate-only mode (--name or --migrate-only) since migrations run
171+
// against the currently installed package version, not a remote one.
172+
if (!disableVersionCheck && options.packages?.length && !options.migrateOnly) {
171173
const cliVersionToInstall = await checkCLIVersion(
172174
options.packages,
173175
logger,

0 commit comments

Comments
 (0)