ng upgrade: incompatible peer dependency error prevents from auto-updating
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
upgradebranch of repo https://github.com/juristr/ng-upgrade-test yarn install(ornpm install=> I used yarn)- Try upgrading the Angular dependencies, using for instance
ng update @angular/core. I already performed the@angular/cliupgrade command which adjusts theangular.jsonetc.
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)
ng update --all --force this worked for me.
Happening on update to Angular 7 and TypeScript 3.1 too.
Wow that's great news!
On Fri, 19 Oct 2018, 22:03 Luiz Machado, [email protected] wrote:
Happening on update to Angular 7 and TypeScript 3.1 too.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/angular/angular-cli/issues/10875#issuecomment-431422087, or mute the thread https://github.com/notifications/unsubscribe-auth/AEHilw6eaQ_YPfxUyF_6Z3H-xLP5NHaXks5umf7LgaJpZM4UAT9m .
The update with --force does work, but some packages like ng-packagr breaks due to tsickle version.
ng update @angular/cli this will do the trick
At this time, just the update as @demonguru18 said should work.
Here is an Starter Project I created for Asp.net Core 2.1, Angular 7.0.3 and Bootstrap 4.1.3 You can download this project and start. In case you want to start from scratch https://github.com/demonguru18/Angular7DotNetCore2.1BootStrap4
If updating old project, follow this
first run ng update --all then run ng update @angular/cli Make sure you have update version of Jquery to run Bootsrap 4 Cheers 👍
** If you get an error saying,
Global Angular CLI version greater than local Then first run this command: npm install --save-dev @angular/cli@latest then run ng --update @angular/cli@latest
For Angular 7: first upgrade to [email protected]: https://github.com/mgechev/codelyzer/blob/master/CHANGELOG.md, after that, you can run the ng update @angular/cli command
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?
try
npm install --save bootstrap
Hi you need to upgrade jQuery to use bootstrap 4. In you package manager file change the version of jQuery. Like in my libman.json file i have it like this
{
"version": "1.0",
"defaultProvider": "cdnjs",
"libraries": [
{
"library": "[email protected]",
"destination": "wwwroot/lib/bootstrap/dist",
"files": [
"js/bootstrap.min.js",
"js/bootstrap.js",
"css/bootstrap.min.css",
"css/bootstrap-reboot.css",
"css/bootstrap-grid.css",
"css/bootstrap.css"
]
},
{
"library": "[email protected]",
"destination": "wwwroot/lib/jquery/dist",
"files": [
"jquery.min.js",
"jquery.js"
]
},
{
"library": "[email protected]",
"destination": "wwwroot/lib/popper.js/dist",
"files": [
"esm/popper-utils.min.js",
"esm/popper.js",
"umd/popper-utils.min.js",
"umd/popper.min.js",
"popper.min.js",
"popper-utils.min.js"
]
}
]
}
I've tried executing ng update --all --force but I still get the error
Tried: ng update @angular/core --force
UPDATE package.json (1579 bytes)
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): EPERM: operation not permitted, rmdir 'C:\Users\Ben\Projects\QuixxiStaging\node_modules\fsevents\node_modules' npm WARN [email protected] requires a peer of @angular/core@^6.0.0 but none is installed. You must install peer dependencies yourself. npm WARN [email protected] requires a peer of @angular/compiler@^2.3.1 || >=4.0.0-beta <6.0.0 but none is installed. You must install peer dependencies yourself. npm WARN [email protected] requires a peer of @angular/core@^2.3.1 || >=4.0.0-beta <6.0.0 but none is installed. You must install peer dependencies yourself. npm WARN [email protected] requires a peer of @angular/platform-browser-dynamic@^2.3.1 || >=4.0.0-beta <6.0.0 but none is installed. You must install peer dependencies yourself. npm WARN [email protected] requires a peer of @angular/platform-browser@^2.3.1 || >=4.0.0-beta <6.0.0 but none is installed. You must install peer dependencies yourself. npm WARN [email protected] requires a peer of @angular/common@^2.3.1 || >=4.0.0-beta <6.0.0 but none is installed. You must install peer dependencies yourself. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
Hi, be careful with this command, ng update @ angular / core --next --force, I have used it to update from Angular 4 to 7 and now I have version 8.0.0-beta.3
@codemcu The --next flag is probably not what people are expecting. From the Angular docs
--next=true|false Use the largest version, including beta and RCs
when bootstrapping angular application
What are the order priorites while bootstrapping and main-usage of those file, if any one knows Please clearly explain.
index.js main.ts,
package.json,
tsconfig.json,
tsconfig.app.json,
tsconfig.spec.json,
angular.json
@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.
Yes , splaktar, good day, thanks for your revert, i will go through the angular bootstrapping guide, thank you.
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'.
@adhivenkatesh please open a new issue with a reproduction.
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?
@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.