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

ng update assumes incorrect version present #25925

Closed
1 task
nikita-fuchs opened this issue Sep 29, 2023 · 5 comments
Closed
1 task

ng update assumes incorrect version present #25925

nikita-fuchs opened this issue Sep 29, 2023 · 5 comments

Comments

@nikita-fuchs
Copy link

nikita-fuchs commented Sep 29, 2023

Command

update

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

After a failed run of ng update, successive runs will assume the presence of the version I tried updating to.

Repro:

  1. Have an angular 11 project (applies to other versions, too)
  2. In the project dir, make a run of $ ng update @angular/cli@12 fail for some dependency reasons
  3. fix the issue, rerun $ ng update @angular/cli@12 and get Package '@angular/cli' is already up to date. It basically forgets about the current project not being updated yet and the migration scripts it still needs to run:
$ cat package.json 
...
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^12.2.18",
    "@angular-devkit/core": "^16.2.4",
    "@angular/animations": "^11.2.14",
    "@angular/cli": "~11.2.19",
    "@angular/common": "^11.2.14",
    "@angular/compiler": "^11.2.14",
    "@angular/compiler-cli": "^11.2.14",
    "@angular/core": "^11.2.14",
    "@angular/forms": "^11.2.14",
    "@angular/language-service": "^11.2.14",
    "@angular/platform-browser": "^11.2.14",
    "@angular/platform-browser-dynamic": "^11.2.14",
    "@angular/router": "^11.2.14",
    "@types/extend": "^3.0.0",
    "@types/jasmine": "~3.6.0",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "^12.11.1",
    "@types/prismjs": "~1.4.18",
    "bowser": "^1.7.2",
    "codelyzer": "^6.0.0",
    "core-js": "^2.5.4",
    "date-fns": "2.0.0-alpha.1",
    "element-closest": "^2.0.2",
    "extend": "^3.0.1",
    "fs-extra": "^5.0.0",
    "is-ua-webview": "^1.0.0",
    "jasmine-core": "~3.8.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~6.4.2",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "karma-min-reporter": "^0.1.0",
    "karma-phantomjs-launcher": "^1.0.4",
    "karma-remap-istanbul": "~0.4.0",
    "ng-packagr": "^11.2.4",
    "popper.js": "^1.14.0",
    "prismjs": "^1.29.0",
    "rxjs": "^6.6.7",
    "ts-node": "~5.0.1",
    "tslint": "~6.1.0",
    "typescript": "~4.0.8",
    "web-animations-js": "^2.3.2",
    "zone.js": "~0.10.2"
  }
}%     

Bonus: I think angular CLI is so excited to be updated globally (which makes no sense when just trying to upgrade a project) that it totally forgets to check if the angular project you're in right now actually needs an upgrade ?

$ ng version


Angular CLI: 12.2.18
Node: 16.20.2 (Unsupported)
Package Manager: npm 8.19.4
OS: darwin x64

Angular: 12.2.17
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1202.18
@angular-devkit/build-angular   12.2.18
@angular-devkit/core            16.2.4
@angular-devkit/schematics      16.2.4
@angular/cli                    12.2.18
@schematics/angular             12.2.18
ng-packagr                      12.2.7
rxjs                            6.6.7
typescript                      4.3.5

none of which actually applies to the project of course.

Minimal Reproduction

Repro:

  1. Have an angular 11 project (applies to other versions, too)
  2. In the project dir, make a run of $ ng update @angular/cli@12 fail for some dependency reasons
  3. fix the issue, rerun $ ng update @angular/cli@12 and get Package '@angular/cli' is already up to date. although

Exception or Error

Package '@angular/cli' is already up to date.

Your Environment

This was installed trying to upgrade the above mentioned project.


$ ng version


Angular CLI: 12.2.18
Node: 16.20.2 (Unsupported)
Package Manager: npm 8.19.4
OS: darwin x64

Angular: 12.2.17
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1202.18
@angular-devkit/build-angular   12.2.18
@angular-devkit/core            16.2.4
@angular-devkit/schematics      16.2.4
@angular/cli                    12.2.18
@schematics/angular             12.2.18
ng-packagr                      12.2.7
rxjs                            6.6.7
typescript                      4.3.5



### Anything else relevant?

_No response_
@alan-agius4
Copy link
Collaborator

Dupicate of #22162

@nikita-fuchs
Copy link
Author

Why are you closing this, especially as completed, @alan-agius4 ? In the other issue, this was mistakenly treated as feature request and subjected to some vote. This is clearly unintended behaviour when an updating fails and should be treated as a bug. This issue still persists.

@alan-agius4
Copy link
Collaborator

alan-agius4 commented Oct 5, 2023

That issue was wrongly labelled.

@nikita-fuchs
Copy link
Author

thank you for taking care of it.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Nov 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants