Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I have an Angular application, which uses local shared component (via our own npm server - Verdaccio)
I updated one of the shared libraries, and uses
npm link
to share it into my application to test, and all went well.
I then built it and pushed it the our npm server.
Now, when I try to
npm install
(npm version 7.21.1) it, I get the following error
$ npm i @my-comany/my-component-ui@7.0.5
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: @my-comany/my-application@0.0.1
npm ERR! Found: @angular/core@12.0.5
npm ERR! 2 more (@angular/animations, @angular/cdk)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/core@"12.2.4" from @angular/common@12.2.4
npm ERR! node_modules/@angular/common
npm ERR! @angular/common@"^12.0.5" from the root project
npm ERR! peer @angular/common@"^12.0.0 || ^13.0.0-0" from @angular/cdk@12.2.4
npm ERR! node_modules/@angular/cdk
npm ERR! @angular/cdk@"^12.0.5" from the root project
npm ERR! 1 more (@my-comany/my-suite-ui)
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
My application has the following Angular related dependencies..
"dependencies": {
"@angular/animations": "^12.0.5",
"@angular/cdk": "^12.0.5",
"@angular/common": "^12.0.5",
"@angular/compiler": "^12.0.5",
"@angular/core": "^12.0.5",
"@angular/forms": "^12.0.5",
"@angular/material": "^12.0.5",
"@angular/material-moment-adapter": "^12.0.5",
"@angular/platform-browser": "^12.0.5",
"@angular/platform-browser-dynamic": "^12.0.5",
"@angular/router": "^12.0.5",
"devDependencies": {
"@angular-devkit/build-angular": "~12.0.5",
"@angular/cli": "^12.0.5",
"@angular/compiler-cli": "^12.0.5",
"@angular/language-service": "^12.0.5",
And the shared lib I am trying to install has
"peerDependencies": {
"@angular/animations": "~12.0.5",
"@angular/cdk": "^12.0.5",
"@angular/common": "~12.0.5",
"@angular/core": "~12.0.5",
"@angular/forms": "~12.0.5",
"@angular/material": "^12.0.5",
"@angular/material-moment-adapter": "^12.0.5",
"@angular/platform-browser": "~12.0.5",
"@angular/platform-browser-dynamic": "~12.0.5",
I have looked through all my package files, and there is no mention of @angular/core@"12.2.4" from @angular/common@12.2.4
anywhere.
Where might this could be coming from, or how can I diagnose it myself?
"@angular/core": "~12.0.5",
There's a chance that you'll have to do this with other packages too in order to make this work e.g. this here is what I have:
"@angular/animations": "~12.0.3",
"@angular/cdk": "^12.2.1",
"@angular/common": "~12.0.3",
"@angular/compiler": "~12.0.3",
"@angular/core": "~12.0.3",
"@angular/flex-layout": "^12.0.0-beta.34",
"@angular/forms": "~12.0.3",
"@angular/material": "^12.0.2",
"@angular/platform-browser": "~12.0.3",
"@angular/platform-browser-dynamic": "~12.0.3",
"@angular/router": "~12.0.3",
From this page about semantic versioning:
major.minor.patch
1.0.2
Major, minor and patch represent the different releases of a package.
npm uses the tilde (~
) and caret (^
) to designate which patch and minor versions to use respectively.
So if you see ~1.0.2
it means to install version 1.0.2
or the latest patch version such as 1.0.4
. If you see ^1.0.2
it means to install version 1.0.2
or the latest minor or patch version such as 1.1.0
.
–
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.