Skip to content

--force flag on update does not work with Yarn 2+ #22249

Closed as not planned
Closed as not planned

Description

@ericparton

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

No

Description

Running ng update with the --force argument does not work if using Yarn 2 or greater. Many Yarn command line arguments changed after Yarn 1 in ways that were not backwards compatible.

🔬 Minimal Reproduction

In a project that is configured to use Yarn 3 as the package manager, run the following:

npx @angular/cli@^12 update --force @angular/core@^12 @angular/cli@^12

🔥 Exception or Error


✔ Package successfully installed.
Using package manager: 'yarn'
Collecting installed dependencies...
Found 60 dependencies.
Fetching dependency metadata from registry...
                  Package "angular-password-strength-meter" has an incompatible peer dependency to "@angular/common" (requires "^10.1.5" (extended), would install "12.2.13").
                  Package "angular-password-strength-meter" has an incompatible peer dependency to "@angular/core" (requires "^10.1.5" (extended), would install "12.2.13").
    Updating package.json with dependency @angular-devkit/build-angular @ "12.2.13" (was "12.0.3")...
    Updating package.json with dependency @angular/cli @ "12.2.13" (was "12.0.3")...
    Updating package.json with dependency @angular/compiler-cli @ "12.2.13" (was "12.0.3")...
    Updating package.json with dependency @angular/language-service @ "12.2.13" (was "12.0.3")...
    Updating package.json with dependency @angular/animations @ "12.2.13" (was "12.0.3")...
    Updating package.json with dependency @angular/common @ "12.2.13" (was "12.0.3")...
    Updating package.json with dependency @angular/compiler @ "12.2.13" (was "12.0.3")...
    Updating package.json with dependency @angular/core @ "12.2.13" (was "12.0.3")...
    Updating package.json with dependency @angular/forms @ "12.2.13" (was "12.0.3")...
    Updating package.json with dependency @angular/platform-browser @ "12.2.13" (was "12.0.3")...
    Updating package.json with dependency @angular/platform-browser-dynamic @ "12.2.13" (was "12.0.3")...
    Updating package.json with dependency @angular/router @ "12.2.13" (was "12.0.3")...
  UPDATE package.json (2133 bytes)
Unknown Syntax Error: Command not found; did you mean one of:

  0. yarn cache clean [--mirror] [--all]
  1. yarn cache clean [--mirror] [--all]
  2. yarn config get [--json] [--no-redacted] 
  3. yarn config set [--json] [-H,--home]  
  4. yarn config unset [-H,--home] 
  5. yarn set resolution [-s,--save]  
  6. yarn set version from sources [--path #0] [--repository #0] [--branch #0] [--plugin #0] [--no-minify] [-f,--force] [--skip-plugins]
  7. yarn set version [--only-if-needed] 
  8. yarn workspaces list [--since] [-R,--recursive] [-v,--verbose] [--json]
  9. yarn --clipanion=definitions
 10. yarn help
 11. yarn help
 12. yarn help
 13. yarn  ...
 14. yarn -v
 15. yarn -v
 16. yarn add [--json] [-E,--exact] [-T,--tilde] [-C,--caret] [-D,--dev] [-P,--peer] [-O,--optional] [--prefer-dev] [-i,--interactive] [--cached] [--mode #0] ...
 17. yarn bin [-v,--verbose] [--json] [name]
 18. yarn config [-v,--verbose] [--why] [--json]
 19. yarn dedupe [-s,--strategy #0] [-c,--check] [--json] [--mode #0] ...
 20. yarn exec  ...
 21. yarn explain peer-requirements [hash]
 22. yarn info [-A,--all] [-R,--recursive] [-X,--extra #0] [--cache] [--dependents] [--manifest] [--name-only] [--virtuals] [--json] ...
 23. yarn install [--json] [--immutable] [--immutable-cache] [--check-cache] [--inline-builds] [--mode #0]
 24. yarn install [--json] [--immutable] [--immutable-cache] [--check-cache] [--inline-builds] [--mode #0]
 25. yarn install [--json] [--immutable] [--immutable-cache] [--check-cache] [--inline-builds] [--mode #0]
 26. yarn link [-A,--all] [-p,--private] [-r,--relative] 
 27. yarn unlink [-A,--all] ...
 28. yarn node ...
 29. yarn plugin import from sources [--path #0] [--repository #0] [--branch #0] [--no-minify] [-f,--force] 
 30. yarn plugin import 
 31. yarn plugin remove 
 32. yarn plugin list [--json]
 33. yarn plugin runtime [--json]
 34. yarn rebuild ...
 35. yarn remove [-A,--all] [--mode #0] ...
 36. yarn run
 37. yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only]  ...
 38. yarn up [-i,--interactive] [-E,--exact] [-T,--tilde] [-C,--caret] [-R,--recursive] [--mode #0] ...
 39. yarn why [-R,--recursive] [--json] [--peers] 
 40. yarn workspace   ...
 41. yarn create [-p,--package #0] [-q,--quiet]  ...
 42. yarn dlx [-p,--package #0] [-q,--quiet]  ...
 43. yarn init [-p,--private] [-w,--workspace] [-i,--install]
 44. yarn npm audit [-A,--all] [-R,--recursive] [--environment #0] [--json] [--severity #0]
 45. yarn npm info [-f,--fields #0] [--json] ...
 46. yarn npm login [-s,--scope #0] [--publish]
 47. yarn npm logout [-s,--scope #0] [--publish] [-A,--all]
 48. yarn npm publish [--access #0] [--tag #0] [--tolerate-republish]
 49. yarn npm tag add  
 50. yarn npm tag list [--json] [package]
 51. yarn npm tag remove  
 52. yarn npm whoami [-s,--scope #0] [--publish]
 53. yarn pack [--install-if-needed] [-n,--dry-run] [--json] [-o,--out #0]
 54. yarn patch-commit [-s,--save] 
 55. yarn patch [--json] 
 56. yarn unplug [-A,--all] [-R,--recursive] [--json] ...

While running --silent --force
✖ Package install failed, see above.

🌍 Your Environment


     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 12.2.13
Node: 16.13.0 (Unsupported)
Package Manager: yarn 3.1.1
OS: darwin x64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1202.13 (cli-only)
@angular-devkit/build-angular   
@angular-devkit/core            12.2.13 (cli-only)
@angular-devkit/schematics      12.2.13 (cli-only)
@angular/cli                    12.2.13 (cli-only)
@schematics/angular             12.2.13 (cli-only)
rxjs                            6.6.7 (cli-only)
typescript                      

Activity

  1. modified the milestone: Backlog on Nov 30, 2021
  2. kwiateusz commented on Dec 10, 2021

    @kwiateusz

    I have same problem. I need to run yarn install and ng update --from --to manually, this is a bit annoying.

    It's look like it's connected with #22048 and silent flag

  3. clydin commented on May 27, 2022

    @clydin
    Member

    Duplicate of #22048

  4. ericparton commented on Jun 27, 2022

    @ericparton
    Author

    does closing this issue mean that the angular cli will never fully support any new version of yarn?

  5. Lonli-Lokli commented on Jul 7, 2022

    @Lonli-Lokli

    @ericparton it should work, you should raise new issue if it's now working.

    Force usage should be fixed in 14.0.5 with this commit #23500

  6. angular-automatic-lock-bot commented on Aug 7, 2022

    @angular-automatic-lock-bot

    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.

  7. locked and limited conversation to collaborators on Aug 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions