Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"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: [email protected]
npm ERR! Found: @aws-cdk/[email protected]
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/[email protected]
npm ERR! node_modules/@aws-cdk/aws-iam
npm ERR!   peer @aws-cdk/aws-iam@"1.95.1" from @aws-cdk/[email protected]
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/[email protected]
npm ERR!   node_modules/@aws-cdk/aws-cloudwatch
npm ERR!     peer @aws-cdk/aws-cloudwatch@"1.95.1" from @aws-cdk/[email protected]
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: [email protected]
npm ERR! Found: @aws-cdk/[email protected]
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/[email protected]
npm ERR! node_modules/@aws-cdk/aws-iam
npm ERR!   peer @aws-cdk/aws-iam@"1.95.1" from @aws-cdk/[email protected]
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/[email protected]
npm ERR!   node_modules/@aws-cdk/aws-cloudwatch
npm ERR!     peer @aws-cdk/aws-cloudwatch@"1.95.1" from @aws-cdk/[email protected]
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. 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.

// 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"
  }
like image 476
Sean D Avatar asked Sep 05 '25 01:09

Sean D


1 Answers

From comments, installing the dependency with same version as of aws-cdk and @aws-cdk/core solved the issue.

npm install @aws-cdk/[email protected]

like image 86
Balu Vyamajala Avatar answered Sep 07 '25 06:09

Balu Vyamajala