简体   繁体   English

安装 AWS CDK 构造库时出现“ERESOLVE 无法解析依赖关系树”

[英]“ERESOLVE unable to resolve dependency tree” when installing AWS CDK construct library

$ npm i @aws-cdk/aws-ec2
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: cdk_sample@0.1.0
npm ERR! Found: @aws-cdk/core@1.95.0
npm ERR! node_modules/@aws-cdk/core
npm ERR!   @aws-cdk/core@"1.95.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @aws-cdk/core@"1.95.1" from @aws-cdk/aws-iam@1.95.1
npm ERR! node_modules/@aws-cdk/aws-iam
npm ERR!   peer @aws-cdk/aws-iam@"1.95.1" from @aws-cdk/aws-ec2@1.95.1
npm ERR!   node_modules/@aws-cdk/aws-ec2
npm ERR!     @aws-cdk/aws-ec2@"*" from the root project
npm ERR!   peer @aws-cdk/aws-iam@"1.95.1" from @aws-cdk/aws-cloudwatch@1.95.1
npm ERR!   node_modules/@aws-cdk/aws-cloudwatch
npm ERR!     peer @aws-cdk/aws-cloudwatch@"1.95.1" from @aws-cdk/aws-ec2@1.95.1
npm ERR!     node_modules/@aws-cdk/aws-ec2
npm ERR!       @aws-cdk/aws-ec2@"*" from the root project
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.
npm ERR! 
npm ERR! See /home/sean/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/sean/.npm/_logs/2021-03-27T00_41_58_124Z-debug.log
sean@desktop:~/WebstormProjects/cdkSample$ npm i @aws-cdk/aws-ec2
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: cdk_sample@0.1.0
npm ERR! Found: @aws-cdk/core@1.95.0
npm ERR! node_modules/@aws-cdk/core
npm ERR!   @aws-cdk/core@"1.95.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @aws-cdk/core@"1.95.1" from @aws-cdk/aws-iam@1.95.1
npm ERR! node_modules/@aws-cdk/aws-iam
npm ERR!   peer @aws-cdk/aws-iam@"1.95.1" from @aws-cdk/aws-ec2@1.95.1
npm ERR!   node_modules/@aws-cdk/aws-ec2
npm ERR!     @aws-cdk/aws-ec2@"*" from the root project
npm ERR!   peer @aws-cdk/aws-iam@"1.95.1" from @aws-cdk/aws-cloudwatch@1.95.1
npm ERR!   node_modules/@aws-cdk/aws-cloudwatch
npm ERR!     peer @aws-cdk/aws-cloudwatch@"1.95.1" from @aws-cdk/aws-ec2@1.95.1
npm ERR!     node_modules/@aws-cdk/aws-ec2
npm ERR!       @aws-cdk/aws-ec2@"*" from the root project
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.
npm ERR! 
npm ERR! See /home/sean/.npm/eresolve-report.txt for a full report.

The --force option sounds non-ideal. --force选项听起来并不理想。 What should be done to fix the upstream dependency conflict?解决上游依赖冲突应该怎么做? I do know that AWS CDK is very strict when it comes to matching package versions between the core and construct libs.我确实知道 AWS CDK 在匹配核心库和构造库之间的 package 版本时非常严格。

// project generated via $ cdk init app --language typescript
  "devDependencies": {
    "@aws-cdk/assert": "1.95.0",
    "@types/jest": "^26.0.10",
    "@types/node": "10.17.27",
    "aws-cdk": "1.95.0",
    "jest": "^26.4.2",
    "ts-jest": "^26.2.0",
    "ts-node": "^9.0.0",
    "typescript": "~3.9.7"
  },
  "dependencies": {
    "@aws-cdk/core": "1.95.0",
    "source-map-support": "^0.5.16"
  }

From comments, installing the dependency with same version as of aws-cdk and @aws-cdk/core solved the issue.根据评论,安装与 aws-cdk 和 @aws-cdk/core 版本相同的依赖项解决了该问题。

npm install @aws-cdk/aws-ec2@1.95.0 npm 安装@aws-cdk/aws-ec2@1.95.0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 安装依赖项产生:ERESOLVE unable to resolve dependency tree - Installing dependency produces: ERESOLVE unable to resolve dependency tree ERESOLVE 无法解析依赖树 - ERESOLVE unable to resolve dependency tree npm 错误! 安装@nest/microservices 时ERESOLVE 无法解析依赖树 - npm ERR! ERESOLVE unable to resolve dependency tree when installing @nest/microservices npm 安装 - ERESOLVE 无法解析依赖树 - npm install - ERESOLVE unable to resolve dependency tree ERESOLVE 无法解析 redux 的依赖关系树 - ERESOLVE unable to resolve dependency tree for redux 为什么错误? ERESOLVE unable to resolve dependency tree 被抛出,如何解决? - Why ERR! ERESOLVE unable to resolve dependency tree is thrown and how to resolve it? npm ERESOLVE 无法解析依赖树 NestJs Passport - npm ERESOLVE unable to resolve dependency tree NestJs Passport 无法安装 package Pinia,因为 ERESOLVE 无法解析依赖关系树 - Can't install package Pinia because of ERESOLVE unable to resolve dependency tree Heroku Shopify 应用程序错误 'npm ERR! ERESOLVE 无法解析依赖树' - Heroku Shopify Application Error 'npm ERR! ERESOLVE unable to resolve dependency tree' 使用 Angular 13 安装 ngrx 商店时出现错误无法解析依赖关系树 - ERROR unable to resolve dependency tree when installing ngrx store with Angular 13
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM