Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
yamatatsu opened this issue Jun 15, 2022 · 10 comments · Fixed by #20752
Assignees
Labels
bug This issue is a bug. management/tracking Issues that track a subject or multiple issues p0 package/tools Related to AWS CDK Tools or CLI

Comments

@yamatatsu
Copy link
Contributor

yamatatsu commented Jun 15, 2022

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

@yamatatsu yamatatsu added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jun 15, 2022
@github-actions github-actions bot added the package/tools Related to AWS CDK Tools or CLI label Jun 15, 2022
@kellertk kellertk added p0 and removed needs-triage This issue or PR still needs to be triaged. labels Jun 15, 2022
@kellertk
Copy link
Contributor

kellertk@147dda2b78f5:~/test2 $ cdk --version
2.28.0 (build ba233f0)
kellertk@147dda2b78f5:~/test2 $ cdk init --language=typescript
Applying project template app for typescript
# Welcome to your CDK TypeScript project

This is a blank project for CDK development with TypeScript.

The `cdk.json` file tells the CDK Toolkit how to execute your app.

## Useful commands

* `npm run build`   compile typescript to js
* `npm run watch`   watch for changes and compile
* `npm run test`    perform the jest unit tests
* `cdk deploy`      deploy this stack to your default AWS account/region
* `cdk diff`        compare deployed stack with current state
* `cdk synth`       emits the synthesized CloudFormation template

Initializing a new git repository...
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: 	git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: 	git branch -m <name>
Executing npm install...
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/kellertk/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/kellertk/.npm/_logs/2022-06-15T20_20_15_097Z-debug-0.log
npm install failed: npm exited with status 1
✅ All done!

@indrora
Copy link
Contributor

indrora commented Jun 15, 2022

Confirmed on macos/intel/node18:

[~/src/asdfasdfasdf]$ npx cdk@2.28.0 init app --language=typescript
Need to install the following packages:
  cdk@2.28.0
Ok to proceed? (y) y
Applying project template app for typescript
# Welcome to your CDK TypeScript project

This is a blank project for CDK development with TypeScript.

The `cdk.json` file tells the CDK Toolkit how to execute your app.

## Useful commands

* `npm run build`   compile typescript to js
* `npm run watch`   watch for changes and compile
* `npm run test`    perform the jest unit tests
* `cdk deploy`      deploy this stack to your default AWS account/region
* `cdk diff`        compare deployed stack with current state
* `cdk synth`       emits the synthesized CloudFormation template

Initializing a new git repository...
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: 	git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: 	git branch -m <name>
bin/asdfasdfasdf.ts:18:  // env: { account: '123456789012', region: 'us-east-1' },

[ERROR] Matched one or more prohibited patterns

Possible mitigations:
- Mark false positives as allowed using: git config --add secrets.allowed ...
- Mark false positives as allowed by adding regular expressions to .gitallowed at repository's root directory
- List your configured patterns: git config --get-all secrets.patterns
- List your configured allowed patterns: git config --get-all secrets.allowed
- List your configured allowed patterns in .gitallowed at repository's root directory
- Use --no-verify if this is a one-time false positive
Unable to initialize git repository for your project.
Executing npm install...
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/gangwere/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/gangwere/.npm/_logs/2022-06-15T20_19_58_382Z-debug-0.log
npm install failed: npm exited with status 1
✅ All done!

This is definitely a P0.

@indrora
Copy link
Contributor

indrora commented Jun 15, 2022

Verified: 2.27.0 works

[~/src/asdfasdfasdf]$ npx cdk@2.27.0 init app --language=typescript   *[master]
Need to install the following packages:
  cdk@2.27.0
Ok to proceed? (y) y
Applying project template app for typescript
# Welcome to your CDK TypeScript project

This is a blank project for CDK development with TypeScript.

The `cdk.json` file tells the CDK Toolkit how to execute your app.

## Useful commands

* `npm run build`   compile typescript to js
* `npm run watch`   watch for changes and compile
* `npm run test`    perform the jest unit tests
* `cdk deploy`      deploy this stack to your default AWS account/region
* `cdk diff`        compare deployed stack with current state
* `cdk synth`       emits the synthesized CloudFormation template

Executing npm install...
✅ All done!

@kellertk
Copy link
Contributor

Verified: 1.160.0 works

kellertk@147dda2b78f5:~/test2 ‹master*›$ npx cdk@1.160.0 init --language=typescript
Need to install the following packages:
  cdk@1.160.0
Ok to proceed? (y) y
Applying project template app for typescript
# Welcome to your CDK TypeScript project

This is a blank project for CDK development with TypeScript.

The `cdk.json` file tells the CDK Toolkit how to execute your app.

## Useful commands

* `npm run build`   compile typescript to js
* `npm run watch`   watch for changes and compile
* `npm run test`    perform the jest unit tests
* `cdk deploy`      deploy this stack to your default AWS account/region
* `cdk diff`        compare deployed stack with current state
* `cdk synth`       emits the synthesized CloudFormation template

Executing npm install...
✅ All done!

NOTICES

19836	AWS CDK v1 has entered maintenance mode

	Overview: AWS CDK v1 has entered maintenance mode on June 1, 2022.
	          Migrate to AWS CDK v2 to continue to get the latest features
	          and fixes!

	Affected versions: framework: 1.*, cli: 1.*

	More information at: https://github.com/aws/aws-cdk/issues/19836


If you don’t want to see a notice anymore, use "cdk acknowledge <id>". For example, "cdk acknowledge 19836".

@kellertk kellertk assigned iliapolo and unassigned rix0rrr Jun 15, 2022
@iliapolo
Copy link
Contributor

@yamatatsu Thanks for reporting. We are on it, I believe your PR should do the trick but I want to double check.

@indrora
Copy link
Contributor

indrora commented Jun 15, 2022

This is a regression specifically in 2.28.

It looks like ts-jest got bumped up: https://www.npmjs.com/package/ts-jest so we should plan on that soon.

@iliapolo iliapolo changed the title (init-templates): typescript template has a package dependencies error ‼️ NOTICE: Conflicting peer dependency: @types/jest@27.5.2 on typescript init templates for CDK v2 Jun 15, 2022
@iliapolo iliapolo added the management/tracking Issues that track a subject or multiple issues label Jun 15, 2022
@iliapolo iliapolo pinned this issue Jun 15, 2022
@mergify mergify bot closed this as completed in #20752 Jun 15, 2022
mergify bot pushed a commit that referenced this issue Jun 15, 2022
fix #20751

----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@iliapolo iliapolo reopened this Jun 15, 2022
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@iliapolo
Copy link
Contributor

iliapolo commented Jun 15, 2022

Keeping open until the release is out

iliapolo pushed a commit that referenced this issue Jun 15, 2022
fix #20751

----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@iliapolo iliapolo mentioned this issue Jun 15, 2022
4 tasks
mergify bot added a commit that referenced this issue Jun 15, 2022
Patch release to resolve #20751

----

### All Submissions:

* [ ] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@iliapolo
Copy link
Contributor

Patch release available: https://www.npmjs.com/package/aws-cdk/v/2.28.1

@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@iliapolo iliapolo mentioned this issue Jun 19, 2022
4 tasks
mergify bot pushed a commit that referenced this issue Jun 21, 2022
In #19893, we added init-templates `package.json` files to our automatic upgrades mechanism. The packages `jest` and `ts-jest` were (not sure why...), added to the rejection list, i.e they specifically will not be upgraded; However, `@types/jest` was not added to this list, thereby creating a potential major version mismatch between them. 

This is exactly what happened here: #20751

This PR rejects upgrades to `@types/jest` as well, to keep them in sync.

----

### All Submissions:

* [X] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@MrArnoldPalmer MrArnoldPalmer unpinned this issue Jun 27, 2022
daschaa pushed a commit to daschaa/aws-cdk that referenced this issue Jul 9, 2022
…0752)

fix aws#20751

----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
daschaa pushed a commit to daschaa/aws-cdk that referenced this issue Jul 9, 2022
In aws#19893, we added init-templates `package.json` files to our automatic upgrades mechanism. The packages `jest` and `ts-jest` were (not sure why...), added to the rejection list, i.e they specifically will not be upgraded; However, `@types/jest` was not added to this list, thereby creating a potential major version mismatch between them. 

This is exactly what happened here: aws#20751

This PR rejects upgrades to `@types/jest` as well, to keep them in sync.

----

### All Submissions:

* [X] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. management/tracking Issues that track a subject or multiple issues p0 package/tools Related to AWS CDK Tools or CLI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants