Home > other >  How can I install two different versions of the same dependency on the same project?
How can I install two different versions of the same dependency on the same project?

Time:06-28

My question is: how to install all the missing peerDependencies with their different required versions? or How to Install Multiple Versions of the Same Package ?

When i run npx check-peer-dependencies --yarn --install OR npx check-peer-dependencies --findSolutions

I found this Solution but the problem is that I don't want to change the name of each package because the project is already in production and it would be a lot of work to do after changing the dependency names, all I need is to fix the missing dependency warnings

**the command above gives me that : **

npx: installed 40 in 3.1s
  ✅  @angular/animations ^11.0.0 || ^12.0.0-0 is required by @angular/[email protected] (12.2.16 is installed)
  ✅  @angular/animations 12.2.16 is required by @angular/[email protected] (12.2.16 is installed)
  ✅  @angular/animations >=4 is required by @savantly/[email protected] (12.2.16 is installed)
  ❌  @angular/animations ^7.0.0 is required by [email protected]) (12.2.16 is installed)
  ✅  @angular/cdk 11.2.13 is required by @angular/[email protected] (11.2.13 is installed)
  ❌  @angular/cdk ~2.0.0-beta.12 is required by @savantly/[email protected]) (11.2.13 is installed)
  ❌  @angular/cdk 2.0.0-beta.12 is required by @angular/[email protected]) (11.2.13 is installed)
  ❌  @angular/cdk 2.0.0-beta.12 is required by @angular/[email protected]) (11.2.13 is installed)
  ❌  @angular/cdk ^7.0.0 is required by [email protected]) (11.2.13 is installed)
  ❌  @angular/common ^7.0.0 is required by @angular-cool/[email protected]) (12.2.16 is installed)
  ✅  @angular/common ^11.0.0 || ^12.0.0-0 is required by @angular/[email protected] (12.2.16 is installed)
  ✅  @angular/common 12.2.16 is required by @angular/[email protected] (12.2.16 is installed)
  ✅  @angular/common ^12.0.0 || ^13.0.0-0 is required by @angular/[email protected] (12.2.16 is installed)
  ✅  @angular/common ^11.0.0 || ^12.0.0-0 is required by @angular/[email protected] (12.2.16 is installed)
  ✅  @angular/common 12.2.16 is required by @angular/[email protected] (12.2.16 is installed)
  ✅  @angular/common 12.2.16 is required by @angular/[email protected] (12.2.16 is installed)
  ✅  @angular/common 12.2.16 is required by @angular/[email protected] (12.2.16 is installed)
  ✅  @angular/common >=5.0.0 is required by @ckeditor/[email protected] (12.2.16 is installed)
  ❌  @angular/common >=7.0.0 <9.0.0 is required by @fullcalendar/[email protected]) (12.2.16 is installed)
  ❌  @angular/common >=6.0.0 <8.0.0 is required by @ng-select/[email protected]) (12.2.16 is installed)
  ✅  @angular/common >=7.0.0 is required by @ngx-translate/[email protected] (12.2.16 is installed)
  ✅  @angular/common >=4 is required by @savantly/[email protected] (12.2.16 is installed)
  ❌  @angular/common ~4.4.4 is required by @angular/[email protected]) (12.2.16 is installed)
  ❌  @angular/common ~4.4.4 is required by @angular/[email protected]) (12.2.16 is installed)
  ❌  @angular/common <9.0.0 is required by @swimlane/[email protected]) (12.2.16 is installed)
  ❌  @angular/common ^7.1.0 is required by [email protected]) (12.2.16 is installed)
  ❌  @angular/common ^2.0.0 is required by @angular/[email protected]) (12.2.16 is installed)
  ❌  @angular/common ~4.4.4 is required by @angular/[email protected]) (12.2.16 is installed)
  ❌  @angular/common ^2.0.0 is required by @angular/[email protected]) (12.2.16 is installed)
  ❌  @angular/common ^2.0.0 is required by @angular/[email protected]) (12.2.16 is installed)
  ❌  @angular/common ^2.0.0 is required by @angular/[email protected]) (12.2.16 is installed)
  ❌  @angular/common ^7.0.0 is required by [email protected]) (12.2.16 is installed)
  ✅  @angular/common >=7.0.0 is required by @angular/[email protected] (12.2.16 is installed)
  ❌  @angular/common 7.2.16 is required by @angular/[email protected]) (12.2.16 is installed)
  ✅  @angular/common >=7.0.0 is required by [email protected] (12.2.16 is installed)
  ✅  @angular/common >=9.0.0-0 is required by [email protected] (12.2.16 is installed)
  ✅  @angular/common >= 8.0.0 is required by [email protected] (12.2.16 is installed)
  ✅  @angular/common 8.x - 13.x is required by [email protected] (12.2.16 is installed)
  ❌  @angular/common ^7.0.0 || ^8.0.0 is required by [email protected]) (12.2.16 is installed)
  ✅  @angular/common >=5.0.0 is required by [email protected] (12.2.16 is installed)
  ❌  @angular/common >=5.0.0 <10.0.0 is required by [email protected]) (12.2.16 is installed)
  ✅  @angular/compiler 12.2.16 is required by @angular/[email protected] (12.2.16 is installed)
  ✅  @angular/compiler >=4 is required by @savantly/[email protected] (12.2.16 is installed)
  ❌  @angular/compiler ^2.0.0 is required by @angular/[email protected]) (12.2.16 is installed)
  ❌  @angular/core ^7.0.0 is required by @angular-cool/[email protected]) (12.2.16 is installed)
  ✅  @angular/core 12.2.16 is required by @angular/[email protected] (12.2.16 is installed)
  ✅  @angular/core ^11.0.0 || ^12.0.0-0 is required by @angular/[email protected] (12.2.16 is installed)
  ✅  @angular/core 12.2.16 is required by @angular/[email protected] (12.2.16 is installed)
  ✅  @angular/core 12.2.16 is required by @angular/[email protected] (12.2.16 is installed)
  ✅  @angular/core ^12.0.0 || ^13.0.0-0 is required by @angular/[email protected] (12.2.16 is installed)
  ❌  @angular/core 8.0.0-beta.10 1.sha-a28b3e3 is required by @angular/[email protected] 1.sha-a28b3e3) (12.2.16 is installed)
  ✅  @angular/core ^11.0.0 || ^12.0.0-0 is required by @angular/[email protected] (12.2.16 is installed)
  ✅  @angular/core ^11.0.0 || ^12.0.0-0 is required by @angular/[email protected] (12.2.16 is installed)
  ✅  @angular/core 12.2.16 is required by @angular/[email protected] (12.2.16 is installed)
  ✅  @angular/core 12.2.16 is required by @angular/[email protected] (12.2.16 is installed)
  ✅  @angular/core 12.2.16 is required by @angular/[email protected] (12.2.16 is installed)
  ✅  @angular/core >=5.0.0 is required by @ckeditor/[email protected] (12.2.16 is installed)
  ❌  @angular/core ^8.0.0-rc.5 is required by @fortawesome/[email protected]) (12.2.16 is installed)
  ❌  @angular/core >=7.0.0 <9.0.0 is required by @fullcalendar/[email protected]) (12.2.16 is installed)
  ❌  @angular/core >=6.0.0 <8.0.0 is required by @ng-select/[email protected]) (12.2.16 is installed)
  ✅  @angular/core >=7.0.0 is required by @ngx-translate/[email protected] (12.2.16 is installed)
  ✅  @angular/core >=4 is required by @savantly/[email protected] (12.2.16 is installed)
  ❌  @angular/core ~4.4.4 is required by @angular/[email protected]) (12.2.16 is installed)
  ❌  @angular/core 7.2.16 is required by @angular/[email protected]) (12.2.16 is installed)
  ❌  @angular/core ~4.4.4 is required by @angular/[email protected]) (12.2.16 is installed)
  ❌  @angular/core <9.0.0 is required by @swimlane/[email protected]) (12.2.16 is installed)
  ❌  @angular/core ^7.1.0 is required by [email protected]) (12.2.16 is installed)
  ❌  @angular/core ^2.0.0 is required by @angular/[email protected]) (12.2.16 is installed)
  ❌  @angular/core ^2.0.0 is required by @angular/[email protected]) (12.2.16 is installed)
  ❌  @angular/core ^2.0.0 is required by @angular/[email protected]) (12.2.16 is installed)
  ❌  @angular/core ^2.0.0 is required by @angular/[email protected]) (12.2.16 is installed)
  ❌  @angular/core ~4.4.4 is required by @angular/[email protected]) (12.2.16 is installed)
  ❌  @angular/core ^2.0.0 is required by @angular/[email protected]) (12.2.16 is installed)
  ❌  @angular/core ^2.0.0 is required by @angular/[email protected]) (12.2.16 is installed)
  ❌  @angular/core ^2.0.0 is required by @angular/[email protected]) (12.2.16 is installed)
  ❌  @angular/core ^7.0.0 is required by [email protected]) (12.2.16 is installed)
  ❌  @angular/core 7.2.16 is required by @angular/[email protected]) (12.2.16 is installed)
  ✅  @angular/core >=7.0.0 is required by @angular/[email protected] (12.2.16 is installed)
  ❌  @angular/core 7.2.16 is required by @angular/[email protected]) (12.2.16 is installed)
  ❌  @angular/core 7.2.16 is required by @angular/[email protected]) (12.2.16 is installed)
  ✅  @angular/core >=7.0.0 is required by [email protected] (12.2.16 is installed)
  ✅  @angular/core >=9.0.0-0 is required by [email protected] (12.2.16 is installed)
  ✅  @angular/core >= 8.0.0 is required by [email protected] (12.2.16 is installed)
  ✅  @angular/core 8.x - 13.x is required by [email protected] (12.2.16 is installed)
  ❌  @angular/core ^7.0.0 || ^8.0.0 is required by [email protected]) (12.2.16 is installed)
  ✅  @angular/core >=5.0.0 is required by [email protected] (12.2.16 is installed)
  ❌  @angular/core >=5.0.0 <10.0.0 is required by [email protected]) (12.2.16 is installed)
  ✅  @angular/forms ^11.0.0 || ^12.0.0-0 is required by @angular/[email protected] (12.2.16 is installed)
  ✅  @angular/forms >=5.0.0 is required by @ckeditor/[email protected] (12.2.16 is installed)
  ❌  @angular/forms >=6.0.0 <8.0.0 is required [email protected] (4.46.0 is installed)
  ✅  webpack ^4.0.0 || ^5.0.0 is required by [email protected] (4.46.0 is installed)
  ✅  webpack ^4.0.0 || ^5.0.0 is required by  @ng-select/[email protected]) (12.2.16 is installed)
  ✅  @angular/forms >=4 is required by @savantly/[email protected] (12.2.16 is installed)
  ❌  @angular/forms ^7.0.0 is required by [email protected]) (12.2.16 is installed)
  ✅  @angular/forms 8.x - 13.x is required by [email protected] (12.2.16 is installed)
  ❌  @angular/forms ^7.0.0 || ^8.0.0 is required by [email protected]) (12.2.16 is installed)
  ❌  @angular/forms >=5.0.0 <10.0.0 is required by [email protected]) (12.2.16 is installed)
  ✅  @angular/material 11.2.13 is required by @angular/[email protected] (11.2.13 is installed)
  ❌  @angular/material ~2.0.0-beta.12 is required by @savantly/[email protected]) (11.2.13 is installed)
  ❌  @angular/material ^8.0.0 || ^9.0.0 is required by [email protected]) (11.2.13 is installed)
  ✅  @angular/platform-browser 12.2.16 is required by @angular/[email protected] (12.2.16 is installed)
  ❌  @angular/platform-browser 8.0.0-beta.10 1.sha-a28b3e3 is required by @angular/[email protected] 1.sha-a28b3e3) (12.2.16 is installed)
  ✅  @angular/platform-browser 12.2.16 is required by @angular/[email protected] (12.2.16 is installed)[email protected] (4.46.0 is installed)
  ✅  webpack ^4.0.0 || ^5.0.0 is required by [email protected] (4.46.0 is installed)
  ✅  webpack ^4.0.0 || ^5.0.0 is required by 
  ✅  @angular/platform-browser 12.2.16 is required by @angular/[email protected] (12.2.16 is installed)
  ✅  @angular/platform-browser >=4 is required by @savantly/[email protected] (12.2.16 is installed)
  ❌  @angular/platform-browser 7.2.16 is required by @angular/[email protected]) (12.2.16 is installed)
  ❌  @angular/platform-browser <9.0.0 is required by @swimlane/[email protected]) (12.2.16 is installed)
  ❌  @angular/platform-browser ^2.0.0 is required by @angular/[email protected]) (12.2.16 is installed)
  ❌  @angular/platform-browser ^2.0.0 is required by @angular/[email protected]) (12.2.16 is installed)
  ❌  @angular/platform-browser ^2.0.0 is required by @angular/[email protected]) (12.2.16 is installed)
  ❌  @angular/platform-browser 7.2.16 is required by @angular/[email protected]) (12.2.16 is installed)
  ❌  @angular/platform-browser ^7.0.0 || ^8.0.0 is required by [email protected]) (12.2.16 is installed)
  ✅  @angular/platform-browser >=5.0.0 is required by [email protected] (12.2.16 is installed)
  ❌  @fortawesome/angular-fontawesome ^0.2.1 is required by @angular-cool/[email protected]) (0.5.0 is installed)
  ❌  @fortawesome/fontawesome-svg-core ^1.2.9 is required by @angular-cool/[email protected]) (6.1.1 is installed)
  ❌  @fortawesome/fontawesome-svg-core ^1.2.21 is required by @fortawesome/[email protected]) (6.1.1 is installed)
  ❌  ajv ^8.8.2 is required by [email protected]) (6.12.6 is installed)
  ❌  ajv ^8.8.2 is required by [email protected]) (6.12.6 is installed)
  ✅  ajv ^6.9.1 is required by [email protected] (6.12.6 is installed)
  ✅  ajv >=5.0.0 is required by [email protected] (6.12.6 is installed)
  ✅  rxjs ^6.3.3 is required by @angular-cool/[email protected] (6.6.7 is installed)
  ✅  rxjs ^6.5.3 || ^7.0.0 is required by @angular/[email protected] (6.6.7 is installed)
  ✅  rxjs ^6.5.3 || ^7.0.0 is required by @angular/[email protected] (6.6.7 is installed)
  ✅  rxjs ^6.5.3 || ^7.0.0 is required by @angular/[email protected] (6.6.7 is installed)
  ✅  rxjs ^6.5.3 || ^7.0.0 is required by @angular/[email protected] (6.6.7 is installed)
  ✅  rxjs ^6.0.0 is required by @angular/[email protected] 1.sha-a28b3e3 (6.6.7 is installed)
  ✅  rxjs ^6.5.3 || ^7.0.0 is required by @angular/[email protected] (6.6.7 is installed)
  ✅  rxjs >=6.3.0 is required by @ngx-translate/[email protected] (6.6.7 is installed)
  ✅  rxjs >=6.3.0 is required by @ngx-translate/[email protected] (6.6.7 is installed)
  ❌  rxjs ^5.5.2 is required by @savantly/[email protected]) (6.6.7 is installed)
  ✅  rxjs ^6.0.0 is required by @angular/[email protected] (6.6.7 is installed)
  ✅  rxjs ^6.5.2 is required by @swimlane/[email protected] (6.6.7 is installed)
  ❌  rxjs 5.0.0-beta.12 is required by @angular/[email protected]) (6.6.7 is installed)
  ❌  rxjs 5.0.0-beta.12 is required by @angular/[email protected]) (6.6.7 is installed)
  ❌  rxjs 5.0.0-beta.12 is required by @angular/[email protected]) (6.6.7 is installed)
  ✅  rxjs ^6.0.0 is required by @angular/[email protected] (6.6.7 is installed)
  ✅  rxjs ^6.0.0 is required by @angular/[email protected] (6.6.7 is installed)
  ✅  rxjs ^6.0.0 is required by @angular/[email protected] (6.6.7 is installed)
  ✅  rxjs ^6.4.0 || ^6.5.0 is required by [email protected] (6.6.7 is installed)
  ✅  rxjs >=5.5.0 is required by [email protected] (6.6.7 is installed)
  ❌  webpack ^5.0.0 is required by [email protected]) (4.46.0 is installed)
  ❌  webpack ^5.1.0 is required by [email protected]) (4.46.0 is installed)
  ❌  webpack ^5.1.0 is required by [email protected]) (4.46.0 is installed)
  ✅  webpack ^4.0.0 || ^5.0.0 is required by [email protected] (4.46.0 is installed)
  ✅  webpack ^4.0.0 || ^5.0.0 is required by [email protected] (4.46.0 is installed)
  ✅  webpack >=2 is required by [email protected] (4.46.0 is installed)
  ✅  webpack ^4.0.0 || ^5.0.0 is required by [email protected] (4.46.0 is installed)
  ✅  webpack ^4.0.0 || ^5.0.0 is required by [email protected] (4.46.0 is installed)
  ✅  webpack ^4.0.0 is required by [email protected] (4.46.0 is installed)
  ✅  webpack ^4.4.0 is required by [email protected] (4.46.0 is installed)
  ✅  webpack ^4.0.0 is required by [email protected] (4.46.0 is installed)
  ✅  webpack ^3.0.0 || ^4.0.0 is required by [email protected] (4.46.0 is installed)
  ✅  webpack ^4.0.0 || ^5.0.0 is required by [email protected] (4.46.0 is installed)
  ✅  webpack ^4.0.0 || ^5.0.0 is required by [email protected] (4.46.0 is installed)
  ✅  webpack ^4.0.0 is required by [email protected] (4.46.0 is installed)
  ✅  webpack >=4.4.0 is required by [email protected] (4.46.0 is installed)
  ✅  webpack 4.x.x is required by [email protected] (4.46.0 is installed)
  ✅  webpack ^4.36.0 || ^5.0.0 is required by [email protected] (4.46.0 is installed)
  ✅  zone.js ~0.11.4 is required by @angular/[email protected] (0.11.6 is installed)
  ❌  zone.js ^0.8.14 is required by @savantly/[email protected]) (0.11.6 is installed)
  ❌  zone.js ^0.6.21 is required by @angular/[email protected]) (0.11.6 is installed)
  ❌  zone.js ~0.8.26 is required by @angular/[email protected]) (0.11.6 is installed)

Searching for solutions for 75 missing dependencies...

  ❌  Unable to find a version of @angular/animations that satisfies the following peerDependencies: ^11.0.0 || ^12.0.0-0 and 12.2.16 and >=4 and ^7.0.0
  ❌  Unable to find a version of @angular/cdk that satisfies the following peerDependencies: 11.2.13 and ~2.0.0-beta.12 and 2.0.0-beta.12 and ^7.0.0
  ❌  Unable to find a version of @angular/common that satisfies the following peerDependencies: ^7.0.0 and ^11.0.0 || ^12.0.0-0 and 12.2.16 and ^12.0.0 || ^13.0.0-0 and >=5.0.0 and >=7.0.0 <9.0.0 and >=6.0.0 <8.0.0 and >=7.0.0 and >=4 and ~4.4.4 and <9.0.0 and ^7.1.0 and ^2.0.0 and 7.2.16 and >=9.0.0-0 and >= 8.0.0 and 8.x - 13.x and ^7.0.0 || ^8.0.0 and >=5.0.0 <10.0.0
  ❌  Unable to find a version of @angular/compiler that satisfies the following peerDependencies: 12.2.16 and >=4 and ^2.0.0
  ❌  Unable to find a version of @angular/core that satisfies the following peerDependencies: ^7.0.0 and 12.2.16 and ^11.0.0 || ^12.0.0-0 and ^12.0.0 || ^13.0.0-0 and 8.0.0-beta.10 1.sha-a28b3e3 and >=5.0.0 and ^8.0.0-rc.5 and >=7.0.0 <9.0.0 and >=6.0.0 <8.0.0 and >=7.0.0 and >=4 and ~4.4.4 and 7.2.16 and <9.0.0 and ^7.1.0 and ^2.0.0 and >=9.0.0-0 and >= 8.0.0 and 8.x - 13.x and ^7.0.0 || ^8.0.0 and >=5.0.0 <10.0.0
  ❌  Unable to find a version of @angular/forms that satisfies the following peerDependencies: ^11.0.0 || ^12.0.0-0 and >=5.0.0 and >=6.0.0 <8.0.0 and >=4 and ^7.0.0 and 8.x - 13.x and ^7.0.0 || ^8.0.0 and >=5.0.0 <10.0.0
  ❌  Unable to find a version of @angular/material that satisfies the following peerDependencies: 11.2.13 and ~2.0.0-beta.12 and ^8.0.0 || ^9.0.0
  ❌  Unable to find a version of @angular/platform-browser that satisfies the following peerDependencies: 12.2.16 and 8.0.0-beta.10 1.sha-a28b3e3 and >=4 and 7.2.16 and <9.0.0 and ^2.0.0 and ^7.0.0 || ^8.0.0 and >=5.0.0
  ❌  Unable to find a version of ajv that satisfies the following peerDependencies: ^8.8.2 and ^8.0.0 and ^6.9.1 and >=5.0.0
  ❌  Unable to find a version of rxjs that satisfies the following peerDependencies: ^6.3.3 and ^6.5.3 || ^7.0.0 and ^6.0.0 and >=6.3.0 and ^5.5.2 and ^6.5.2 and 5.0.0-beta.12 and ^6.4.0 || ^6.5.0 and >=5.5.0
  ❌  Unable to find a version of webpack that satisfies the following peerDependencies: ^5.0.0 and ^5.1.0 and ^4.0.0 || ^5.0.0 and >=2 and ^4.0.0 and ^4.4.0 and ^3.0.0 || ^4.0.0 and >=4.4.0 and 4.x.x and ^4.36.0 || ^5.0.0
  ❌  Unable to find a version of zone.js that satisfies the following peerDependencies: ~0.11.4 and ^0.8.14 and ^0.6.21 and ~0.8.26

CodePudding user response:

You can use aliases if you really need to do this. Look up npm aliasing.

@angular/common: '13.0.0', @myangular-custom: '4.0.0

Please don't take this example literally but this is the gist of it.? This should better answer your question...

How to install NPM package under alias or different name

  • Related