nx
nx copied to clipboard
Dependency conflict between vitest@4 and @angular/[email protected] in NX v22.2.0
Current Behavior
When creating a new NX workspace with Angular and Vitest, the installation fails with a peer dependency conflict:
npm error ERESOLVE could not resolve
npm error
npm error While resolving: @angular/[email protected]
npm error Found: [email protected]
npm error
npm error Could not resolve dependency:
npm error peerOptional vitest@"^3.1.1" from @angular/[email protected]
Expected Behavior
The workspace should be created successfully without dependency conflicts.
GitHub Repo
No response
Steps to Reproduce
- Run
npx create-nx-workspace@latest - Choose the following options:
- Stack:
angular - Monorepo type:
integrated - Bundler:
esbuild - Unit test runner:
vitest
- Stack:
- Installation fails during
npm install
Nx Report
NX Report complete - copy this into the issue template
Node : 25.2.1
OS : darwin-arm64
Native Target : aarch64-macos
npm : 11.6.2
nx : 22.2.0
@nx/js : 22.2.0
@nx/eslint : 22.2.0
@nx/workspace : 22.2.0
@nx/angular : 22.2.0
@nx/devkit : 22.2.0
@nx/module-federation : 22.2.0
@nx/rspack : 22.2.0
@nx/web : 22.2.0
@nx/webpack : 22.2.0
typescript : 5.9.3
---------------------------------------
Registered Plugins:
@nx/playwright/plugin
@nx/eslint/plugin
---------------------------------------
Cache Usage: 0.00 B / 92.64 GB
---------------------------------------
⚠️ Unable to construct project graph.
Unable to resolve local plugin with import path @nx/playwright/plugin
Error: Unable to resolve local plugin with import path @nx/playwright/plugin
at findNxProjectForImportPath (/Users/ido.tamir/work/prog/nest/seqmate/node_modules/nx/src/project-graph/plugins/resolve-plugin.js:121:11)
at lookupLocalPlugin (/Users/ido.tamir/work/prog/nest/seqmate/node_modules/nx/src/project-graph/plugins/resolve-plugin.js:81:27)
at resolveLocalNxPlugin (/Users/ido.tamir/work/prog/nest/seqmate/node_modules/nx/src/project-graph/plugins/resolve-plugin.js:44:12)
at getPluginPathAndName (/Users/ido.tamir/work/prog/nest/seqmate/node_modules/nx/src/project-graph/plugins/resolve-plugin.js:58:28)
at resolveNxPlugin (/Users/ido.tamir/work/prog/nest/seqmate/node_modules/nx/src/project-graph/plugins/resolve-plugin.js:27:62)
at process.processTicksAndRejections (node:internal/process/task_queues:103:5)
at async loadRemoteNxPlugin (/Users/ido.tamir/work/prog/nest/seqmate/node_modules/nx/src/project-graph/plugins/isolation/plugin-pool.js:34:62)
at async /Users/ido.tamir/work/prog/nest/seqmate/node_modules/nx/src/project-graph/plugins/get-plugins.js:117:48
at async Promise.all (index 0)
at async loadSpecifiedNxPlugins (/Users/ido.tamir/work/prog/nest/seqmate/node_modules/nx/src/project-graph/plugins/get-plugins.js:114:21)
Failure Logs
npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: @angular/[email protected]
npm error Found: [email protected]
npm error node_modules/vitest
npm error dev vitest@"^4.0.0" from the root project
npm error peer vitest@"^1.3.1 || ^2.0.0 || ^3.0.0 || ^4.0.0" from @analogjs/[email protected]
npm error node_modules/@analogjs/vitest-angular
npm error dev @analogjs/vitest-angular@"~2.1.2" from the root project
npm error 4 more (@nx/vite, @nx/vitest, @vitest/coverage-v8, @vitest/ui)
npm error
npm error Could not resolve dependency:
npm error peerOptional vitest@"^3.1.1" from @angular/[email protected]
npm error node_modules/@angular/build
npm error dev @angular/build@"~20.3.0" from the root project
npm error peerOptional @angular/build@">= 18.0.0 < 21.0.0" from @nx/[email protected]
npm error node_modules/@nx/angular
npm error dev @nx/angular@"22.2.0" from the root project
npm error 1 more (@analogjs/vite-plugin-angular)
npm error
npm error Conflicting peer dependency: [email protected]
npm error node_modules/vitest
npm error peerOptional vitest@"^3.1.1" from @angular/[email protected]
npm error node_modules/@angular/build
npm error dev @angular/build@"~20.3.0" from the root project
npm error peerOptional @angular/build@">= 18.0.0 < 21.0.0" from @nx/[email protected]
npm error node_modules/@nx/angular
npm error dev @nx/angular@"22.2.0" from the root project
npm error 1 more (@analogjs/vite-plugin-angular)
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.
Package Manager Version
No response
Operating System
- [x] macOS
- [ ] Linux
- [ ] Windows
- [ ] Other (Please specify)
Additional Information
- NX Version: 22.2.0
- Node Version: v25.2.1
- npm Version: 11.6.2
- Package Manager: npm
- Operating System: macOS