Skip to content

create-nx-workspace@latest with Angular: Could not resolve dependency: jest #32530

@TomONeill

Description

@TomONeill

Current Behavior

After executing npx create-nx-workspace@latest and then executing npm i will fail with the following:

While resolving: @angular-devkit/build-angular@20.1.6
Found: jest@30.1.0
Could not resolve dependency:
peerOptional jest@"^29.5.0" from @angular-devkit/build-angular@20.1.6

This is indeed the case:
https://github.com/angular/angular-cli/blob/d67c2603f5437202d04927cbb277131c6f09945b/packages/angular_devkit/build_angular/package.json#L84

But the init project after creating the new workspace contains jest@30.1.0.

Expected Behavior

Compatible (dev)packages/dependencies

GitHub Repo

No response

Steps to Reproduce

  1. npx create-nx-workspace@latest
 NX   Let's create a new workspace [https://nx.dev/getting-started/intro]

√ Where would you like to create your workspace? · twentyonefourone
√ Which stack do you want to use? · angular
√ Integrated monorepo, or standalone project? · integrated
√ Application name · twentyonefourone
√ Which bundler would you like to use? · webpack
√ Default stylesheet format · scss
√ Do you want to enable Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering)? · No
√ Which unit test runner would you like to use? · jest
√ Test runner to use for end to end (E2E) tests · cypress
√ Which CI provider would you like to use? · skip
√ Would you like remote caching to make your build faster? · skip

 NX   Creating your v21.4.1 workspace.

✔ Installing dependencies with npm
✔ Successfully created the workspace: twentyonefourone
  1. npm i

Nx Report

Node           : 22.17.1
OS             : win32-x64
Native Target  : x86_64-windows
npm            : 11.5.2

nx (global)            : 21.4.1
nx                     : 21.4.1
@nx/js                 : 21.4.1
@nx/jest               : 21.4.1
@nx/eslint             : 21.4.1
@nx/workspace          : 21.4.1
@nx/angular            : 21.4.1
@nx/cypress            : 21.4.1
@nx/devkit             : 21.4.1
@nx/eslint-plugin      : 21.4.1
@nx/module-federation  : 21.4.1
@nx/rspack             : 21.4.1
@nx/web                : 21.4.1
@nx/webpack            : 21.4.1
typescript             : 5.8.3
---------------------------------------
Registered Plugins:
@nx/cypress/plugin
@nx/eslint/plugin
---------------------------------------
Community plugins:
angular-eslint : 20.2.0
---------------------------------------
Cache Usage: 0.00 B / 47.47 GB

Failure Logs

npm i
npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: @angular-devkit/build-angular@20.1.6
npm error Found: jest@30.1.0
npm error node_modules/jest
npm error   dev jest@"^30.0.2" from the root project
npm error   peer jest@"^30.0.0" from jest-preset-angular@15.0.0
npm error   node_modules/jest-preset-angular
npm error     dev jest-preset-angular@"~15.0.0" from the root project
npm error   1 more (ts-jest)
npm error
npm error Could not resolve dependency:
npm error peerOptional jest@"^29.5.0" from @angular-devkit/build-angular@20.1.6
npm error node_modules/@angular-devkit/build-angular
npm error   dev @angular-devkit/build-angular@"~20.1.0" from the root project
npm error   peerOptional @angular-devkit/build-angular@">= 18.0.0 < 21.0.0" from @nx/angular@21.4.1
npm error   node_modules/@nx/angular
npm error     dev @nx/angular@"21.4.1" from the root project
npm error
npm error Conflicting peer dependency: jest@29.7.0
npm error node_modules/jest
npm error   peerOptional jest@"^29.5.0" from @angular-devkit/build-angular@20.1.6
npm error   node_modules/@angular-devkit/build-angular
npm error     dev @angular-devkit/build-angular@"~20.1.0" from the root project
npm error     peerOptional @angular-devkit/build-angular@">= 18.0.0 < 21.0.0" from @nx/angular@21.4.1
npm error     node_modules/@nx/angular
npm error       dev @nx/angular@"21.4.1" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error C:\Users\TomONeill\AppData\Local\npm-cache\_logs\2025-08-27T12_25_06_807Z-eresolve-report.txt
npm error A complete log of this run can be found in: C:\Users\TomONeill\AppData\Local\npm-cache\_logs\2025-08-27T12_25_06_807Z-debug-0.log

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions