Skip to content

‼️ NOTICE: Conflicting peer dependency: @types/jest@27.5.2 on typescript init templates for CDK v2 #20751

@yamatatsu

Description

@yamatatsu

Please add your +1 👍 to let us know you have encountered this

Status: RESOLVED

Overview:

Running cdk init --language=typescript results in an installation error.

Complete Error Message:

> npm i                                                                                                   npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: ts-jest@27.1.5
npm ERR! Found: @types/jest@28.1.1
npm ERR! node_modules/@types/jest
npm ERR!   dev @types/jest@"^28.1.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional @types/jest@"^27.0.0" from ts-jest@27.1.5
npm ERR! node_modules/ts-jest
npm ERR!   dev ts-jest@"^27.1.4" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @types/jest@27.5.2
npm ERR! node_modules/@types/jest
npm ERR!   peerOptional @types/jest@"^27.0.0" from ts-jest@27.1.5
npm ERR!   node_modules/ts-jest
npm ERR!     dev ts-jest@"^27.1.4" 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 /Users/yamamoto.tatsuya/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/yamamoto.tatsuya/.npm/_logs/2022-06-15T16_40_52_462Z-debug-0.log

Workaround:

After to encounter the error, open the package.json file and change the line that reads:

"@types/jest": "^28.1.1",

to

"@types/jest": "^27.5.2",

Then run npm install, and you should be good to go.

Solution:

Upgrade to https://www.npmjs.com/package/aws-cdk/v/2.28.1

Related Issues:


Original posting below

Describe the bug

The typescript template of cdk 2.28.0 has dependency error.

> npm i                                                                                                   npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: ts-jest@27.1.5
npm ERR! Found: @types/jest@28.1.1
npm ERR! node_modules/@types/jest
npm ERR!   dev @types/jest@"^28.1.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional @types/jest@"^27.0.0" from ts-jest@27.1.5
npm ERR! node_modules/ts-jest
npm ERR!   dev ts-jest@"^27.1.4" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @types/jest@27.5.2
npm ERR! node_modules/@types/jest
npm ERR!   peerOptional @types/jest@"^27.0.0" from ts-jest@27.1.5
npm ERR!   node_modules/ts-jest
npm ERR!     dev ts-jest@"^27.1.4" 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 /Users/yamamoto.tatsuya/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/yamamoto.tatsuya/.npm/_logs/2022-06-15T16_40_52_462Z-debug-0.log

This is caused by a version mismatch between "@types/jest": "^28.1.1" and "jest": "^27.5.1".

Expected Behavior

It is expected to be able to install without any errors.

Current Behavior

It has an error.

Reproduction Steps

Use npx cdk@2.28.0 init app --language=typescript in new a directory.

Possible Solution

It can be fixed with "@types/jest": "^27.5.2",

Additional Information/Context

No response

CDK CLI Version

2.28.0

Framework Version

No response

Node.js Version

v16.15.1

OS

macOS 12.4

Language

Typescript

Language Version

3.9.10

Other information

No response

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.management/trackingIssues that track a subject or multiple issuesp0package/toolsRelated to AWS CDK Tools or CLI

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions