Skip to content

ng upgrade: incompatible peer dependency error prevents from auto-updating #10875

Closed

Description

@juristr

Versions

Angular CLI: 6.0.1
Node: 9.11.1
OS: darwin x64
Angular: 5.2.10
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.1
@angular-devkit/build-angular     0.6.1
@angular-devkit/build-optimizer   0.6.1
@angular-devkit/core              0.6.1
@angular-devkit/schematics        0.6.1
@angular/cli                      6.0.1
@ngtools/webpack                  6.0.1
@schematics/angular               0.6.1
@schematics/update                0.6.1
rxjs                              5.5.10
typescript                        2.5.3
webpack                           4.6.0


macOS 10.11.6

Repro steps

  • Clone the upgrade branch of repo https://github.com/juristr/ng-upgrade-test
  • yarn install (or npm install => I used yarn)
  • Try upgrading the Angular dependencies, using for instance ng update @angular/core. I already performed the @angular/cli upgrade command which adjusts the angular.json etc.

Observed behavior

<!-- Normally this includes a stack trace and some more information. -->

I get the following output

❯ ng update @angular/core
                  Package "@angular/compiler-cli" has an incompatible peer dependency to "typescript" (requires ">=2.7.2 <2.8", would install "2.5.3")
Incompatible peer dependencies found. See above.

Desired behavior

It should automatically update the Angular dependencies as well as RxJS and TypeScript (as described in the update.angular.io guide).

Mention any other details that might be useful (optional)

Activity

  1. juristr commented on May 15, 2018

    @juristr
    ContributorAuthor

    @clydin Hi, I was chatting about this in the Angular Slack with @filipesilva and he told me to open the issue here. Let me know if you need more info. Thanks a lot 👍

  2. brandonroberts commented on May 16, 2018

    @brandonroberts
    Contributor

    I'm running into a similar issue when trying to update NgRx.

    If I have all the @ngrx libraries installed and I run ng update @ngrx/store --next I get

    Package "@ngrx/schematics" has a missing peer dependency of "@angular-devkit/core" @ "^0.6.0".
    

    If I run yarn list @angular-devkit/core, I see

    @angular-devkit/core@0.6.1
    
  3. intellix commented on May 19, 2018

    @intellix
    Contributor

    Not sure if it's the same thing, but I'm getting errors like:

    Package "bootstrap" has a missing peer dependency of "jquery" @ "1.9.1 - 3".
    

    I'm using the bootstrap SCSS framework but have no intentions of ever including jQuery ofc. I dunno if this is a problem with bootstrap itself that it has jquery as a peerDep or if the problem is that CLI throws for peer dep WARN.

    Is it perhaps possible to just force the ng update --all?

  4. Teamop commented on May 21, 2018

    @Teamop
    Contributor

    I have the same issue, but instead run ng update @angular/compiler-cli successfully without error.

  5. getabetterpic commented on May 22, 2018

    @getabetterpic

    I'm running into this issue as well, seems the updater is trying to install typescript@2.8.3 but @angular/compiler-cli has a peer dependency of typescript@">=2.7.2 <2.8".

  6. sachinpachori commented on May 22, 2018

    @sachinpachori

    When I ran "ng update @angular/core" got the following errors and cannot upgrade to angular 6:
    Package "angular2-resizable" has an incompatible peer dependency to "@angular/core" (requires ">=3.0.0-rc.0 <4.0.0||>=2.0.0 <3.0.0", would install "6.0.2").
    Package "codelyzer" has an incompatible peer dependency to "@angular/compiler" (requires ">=5.0.0-rc.0 <6.0.0||>=2.3.1 <3.0.0||>=4.0.0-beta <5.0.0", would install "6.0.2").

  7. brandonroberts commented on May 22, 2018

    @brandonroberts
    Contributor

    Just so its noted, the workaround is to use the --force flag when running ng update [package] to override the dependency issues. This will upgrade the packages anyway and you can verify your app with the updated dependencies. If that third party dependency still needs to be updated because of breaking changes, then that package will need to be updated.

    ng update @ngrx/store --next --force
    
  8. clydin commented on May 22, 2018

    @clydin
    Member

    @sachinpachori Those are actually legitimate errors. The project has a dependency (angular2-resizable) that does not support Angular 6. As @brandonroberts mentions, the --force flag can be used (with caution) to update while ignoring those issues.
    And similar with codelyzer; however, since codelyzer is part of the default project this could potentially (and in the future) be automatically updated (depending on the pinning strategy) with a CLI update.

  9. sachinpachori commented on May 23, 2018

    @sachinpachori

    @brandonroberts @clydin thank you that solved my issue.

  10. 32 remaining items

  11. Splaktar commented on May 14, 2019

    @Splaktar
    Contributor

    @adhivenkatesh the Angular Bootstapping Guide might be helpful as well as the Project File Structure Guide. However, I'm not sure that they address that exact question.

  12. adhivenkatesh commented on May 14, 2019

    @adhivenkatesh

    Yes , splaktar, good day, thanks for your revert, i will go through the angular bootstrapping guide, thank you.

  13. adhivenkatesh commented on May 14, 2019

    @adhivenkatesh

    Hi i think some of the files corrected i am using angular 7 version ,
    i have tried in many angles deleted directory and remove ng_modules and installed npm command also nothing happened , here i also used npm cache clean --force , then remove ng_modules then npm install ,
    i have created 3 new projects and again getting the same issue
    please help with best solution ,

    ======================= error =============
    ERROR in node_modules/rxjs/src/internal/scheduled/scheduled.ts(25,40): error TS2345: Argument of type 'import("D:/AngularProjects/AngularRouting/Routing/node_modules/rxjs/internal/types").SchedulerLike' is not assignable to parameter of type 'import("D:/AngularProjects/AngularRouting/Routing/node_modules/rxjs/src/internal/types").SchedulerLike'.
    Types of property 'schedule' are incompatible.
    Type '(work: (this: import("D:/AngularProjects/AngularRouting/Routing/node_modules/rxjs/internal/types").SchedulerAction, state?: T) => void, delay?: number, state?: T) => import("D:/AngularProjects/AngularRouting/Routing/node_modules/rxjs/internal/Subscription").Subscription' is not assignable to type '(work: (this: import("D:/AngularProjects/AngularRouting/Routing/node_modules/rxjs/src/internal/types").SchedulerAction, state?: T) => void, delay?: number, state?: T) => import("D:/AngularProjects/AngularRouting/Routing/node_modules/rxjs/src/internal/Subscription").Subscription'.
    Types of parameters 'work' and 'work' are incompatible.
    The 'this' types of each signature are incompatible.
    Type 'import("D:/AngularProjects/AngularRouting/Routing/node_modules/rxjs/internal/types").SchedulerAction' is not assignable to type 'import("D:/AngularProjects/AngularRouting/Routing/node_modules/rxjs/src/internal/types").SchedulerAction'.
    Types of property 'schedule' are incompatible.
    Type '(state?: T, delay?: number) => import("D:/AngularProjects/AngularRouting/Routing/node_modules/rxjs/internal/Subscription").Subscription' is not assignable to type '(state?: T, delay?: number) => import("D:/AngularProjects/AngularRouting/Routing/node_modules/rxjs/src/internal/Subscription").Subscription'.
    Type 'import("D:/AngularProjects/AngularRouting/Routing/node_modules/rxjs/internal/Subscription").Subscription' is not
    assignable to type 'import("D:/AngularProjects/AngularRouting/Routing/node_modules/rxjs/src/internal/Subscription").Subscription'.
    Property '_parentOrParents' is protected but type 'Subscription' is not a class derived from 'Subscription'.
    node_modules/rxjs/src/internal/scheduled/scheduled.ts(27,37): error TS2345: Argument of type 'import("D:/AngularProjects/AngularRouting/Routing/node_modules/rxjs/internal/types").SchedulerLike' is not assignable to parameter of type 'import("D:/AngularProjects/AngularRouting/Routing/node_modules/rxjs/src/internal/types").SchedulerLike'.
    node_modules/rxjs/src/internal/scheduled/scheduled.ts(29,35): error TS2345: Argument of type 'import("D:/AngularProjects/AngularRouting/Routing/node_modules/rxjs/internal/types").SchedulerLike' is not assignable to parameter of type 'import("D:/AngularProjects/AngularRouting/Routing/node_modules/rxjs/src/internal/types").SchedulerLike'.
    node_modules/rxjs/src/internal/scheduled/scheduled.ts(31,38): error TS2345: Argument of type 'import("D:/AngularProjects/AngularRouting/Routing/node_modules/rxjs/internal/types").SchedulerLike' is not assignable to parameter of type 'import("D:/AngularProjects/AngularRouting/Routing/node_modules/rxjs/src/internal/types").SchedulerLike'.
    node_modules/rxjs/src/internal/observable/from.ts(116,29): error TS2345: Argument of type 'import("D:/AngularProjects/AngularRouting/Routing/node_modules/rxjs/src/internal/types").SchedulerLike' is not assignable to parameter of type 'import("D:/AngularProjects/AngularRouting/Routing/node_modules/rxjs/internal/types").SchedulerLike'.
    Types of property 'schedule' are incompatible.
    Type '(work: (this: import("D:/AngularProjects/AngularRouting/Routing/node_modules/rxjs/src/internal/types").SchedulerAction, state?: T) => void, delay?: number, state?: T) => import("D:/AngularProjects/AngularRouting/Routing/node_modules/rxjs/src/internal/Subscription").Subscription' is not assignable to type '(work: (this: import("D:/AngularProjects/AngularRouting/Routing/node_modules/rxjs/internal/types").SchedulerAction, state?: T) => void, delay?: number, state?: T) => import("D:/AngularProjects/AngularRouting/Routing/node_modules/rxjs/internal/Subscription").Subscription'.
    Types of parameters 'work' and 'work' are incompatible.
    The 'this' types of each signature are incompatible.
    Type 'import("D:/AngularProjects/AngularRouting/Routing/node_modules/rxjs/src/internal/types").SchedulerAction' is not assignable to type 'import("D:/AngularProjects/AngularRouting/Routing/node_modules/rxjs/internal/types").SchedulerAction'.
    Types of property 'schedule' are incompatible.
    Type '(state?: T, delay?: number) => import("D:/AngularProjects/AngularRouting/Routing/node_modules/rxjs/src/internal/Subscription").Subscription' is not assignable to type '(state?: T, delay?: number) => import("D:/AngularProjects/AngularRouting/Routing/node_modules/rxjs/internal/Subscription").Subscription'.
    Type 'import("D:/AngularProjects/AngularRouting/Routing/node_modules/rxjs/src/internal/Subscription").Subscription' is
    not assignable to type 'import("D:/AngularProjects/AngularRouting/Routing/node_modules/rxjs/internal/Subscription").Subscription'.
    Property '_parentOrParents' is protected but type 'Subscription' is not a class derived from 'Subscription'.

  14. Splaktar commented on May 14, 2019

    @Splaktar
    Contributor

    @adhivenkatesh please open a new issue with a reproduction.

  15. added a commit that references this issue on Jun 15, 2019
  16. added a commit that references this issue on Jun 26, 2019
  17. Riccardo-Andreatta commented on Jul 2, 2019

    @Riccardo-Andreatta

    I am getting the same error when I am upgrading from version 5 to version 6 but running ng update @angular/core --next --force is forcing update to the latest release: is there a workaround to update just to the version I want?

  18. Splaktar commented on Jul 2, 2019

    @Splaktar
    Contributor

    @Riccardo-Andreatta ng update @angular/core --migrate-only --from=5 --to=6 --force. See more details in ng update --help or https://angular.io/cli/update.

  19. cjonasw commented on Jul 3, 2019

    @cjonasw

    I didn't want to use --force as it installs unstable packages and also... we shouldn't have to.

    I found a solution to the above that worked for me. I installed the latest codelyzer

    npm install codelyzer@latest --save-dev

    then ran the ng update @whatever I needed to do and it worked with no complaints.

  20. adhivenkatesh commented on Jul 5, 2019

    @adhivenkatesh
  21. ahmar-appify commented on Aug 6, 2019

    @ahmar-appify

    Reinstalling cli worked for me as it installed latest.
    npm uninstall @angular/cli
    npm install @angular/cli

    after this all ng update worked

  22. Ferie commented on Aug 12, 2019

    @Ferie

    @Splaktar I have tried the --from and --to options but they are not working: still they are upgrading directly to the last version available.

    I had to install the specific version (ng update @angular/core@6.1.0) both for core and cli, and then update manually the package.json to update every single module that my application needs (http, common, forms, etc).

  23. clydin commented on Aug 12, 2019

    @clydin
    Member

    The --from and --to options will only affect the --migrate-only option. CLI versions 8.0+ will now error if the options are used incorrectly.

  24. angular-automatic-lock-bot commented on Sep 14, 2019

    @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.

  25. locked and limited conversation to collaborators on Sep 14, 2019
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

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions