try to understand an error report of npm and fail to find the problem – surprisingly the deletion of the node_modules directory fixed it. We were in the process to update angular to 18+ and nx to 19+.
Found: @angular-devkit/[email protected]
node_modules/@angular-devkit/build-angular
dev @angular-devkit/build-angular@"18.0.4" from the root project
peer @angular-devkit/build-angular@">= 15.0.0 < 18.0.0" from @nx/[email protected]
node_modules/@nx/angular
@nx/angular@"19.3.0" from the root project
@nx/angular@"18.3.4" from @nrwl/[email protected]
node_modules/@nrwl/angular
@nrwl/angular@"18.3.4" from @nx/[email protected]
peer @angular-devkit/build-angular@">=15.0.0 <18.0.0" from [email protected]
node_modules/jest-preset-angular
dev jest-preset-angular@"14.1.1" from the root project
Could not resolve dependency:
dev @angular-devkit/build-angular@"18.0.4" from the root project
Conflicting peer dependency: @angular/[email protected]
node_modules/@angular/compiler-cli
peer @angular/compiler-cli@"^18.0.0" from @angular-devkit/[email protected]
node_modules/@angular-devkit/build-angular
dev @angular-devkit/build-angular@"18.0.4" from the root project
How i understand the last part:
- @angular-devkit/[email protected] found in package.json
- package has peer dependency to @angular/compiler-cli@^18.0.0
- failed to resolve @angular/[email protected] (which is also in package.json)
Why does it fail to resolve @angular/[email protected] when its clearly a valid version ?
How i understand the first part:
- [email protected] found in package.json
- version 14.0.3 of this package has peer dependency to @angular-devkit/build-angular@>=15.0.0 <18.0.0
- (resolving errors based on wrong version range)
Why does npm use the old version of jest-preset-angular and nx/angular for resolving ? it seems like it ignore versions specified in the package.json and use the current installed.
(deleting nod_modules to fix an npm dependency problem seem like a bug in npm itself to me)