gpt4 book ai didi

node.js - "ERESOLVE unable to resolve dependency tree"安装 AWS CDK 构造库时

转载 作者:行者123 更新时间:2023-12-04 14:07:58 24 4
gpt4 key购买 nike

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

--force选项听起来不理想。应该怎么做才能解决上游依赖冲突?我知道 AWS CDK 在核心库和构造库之间匹配包版本时非常严格。
// 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"
}

最佳答案

根据评论,安装与 aws-cdk 和 @aws-cdk/core 版本相同的依赖项解决了该问题。

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

关于node.js - "ERESOLVE unable to resolve dependency tree"安装 AWS CDK 构造库时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66826036/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com