I want to use @angular/localize for my angular application. I am using a recently created nestjs backend with an Angular frontend in a Nx monorepo.
When trying to add the Package with npm install @angular/localize
I get the following error:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: @wordle-ase/source@0.0.0
npm ERR! Found: @angular/compiler@17.1.3
npm ERR! node_modules/@angular/compiler
npm ERR! @angular/compiler@"~17.1.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/compiler@"17.2.3" from @angular/localize@17.2.3
npm ERR! node_modules/@angular/localize
npm ERR! @angular/localize@"^17.2.3" 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.
As I want a clean package installation with no dependency issues I do not want to use --force
or --legacy-peer-deps
.
When I saw @angular/localize@17.2.3 depends on @angular/compiler@17.2.3 and I only had version 17.1.3 installed, I tried installing version 17.1.3 of localize as well (npm install @angular/localize@17.1.0
). This command returned no errors.
If I use the command npm update
and also npm install
afterwards though, I get a very similar error message:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: @wordle-ase/source@0.0.0
npm ERR! Found: @angular/compiler@17.1.3
npm ERR! node_modules/@angular/compiler
npm ERR! @angular/compiler@"~17.1.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/compiler@"17.2.3" from @angular/localize@17.2.3
npm ERR! node_modules/@angular/localize
npm ERR! @angular/localize@"^17.1.3" 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.
Why do I get this error? Is it fixable or is it even intended behavior? Can I not update my other packages if there is an issue with @angular/localize? Why can I not reinstall all packages without an error even though there was no dependency issue when first installing it?
In case it is useful, here is my full package.json-File:
{
"name": "@wordle-ase/source",
"version": "0.0.0",
"license": "MIT",
"scripts": {},
"private": true,
"dependencies": {
"@angular/animations": "~17.1.0",
"@angular/cdk": "^17.2.1",
"@angular/common": "~17.1.0",
"@angular/compiler": "~17.1.0",
"@angular/core": "~17.1.0",
"@angular/forms": "~17.1.0",
"@angular/localize": "^17.1.3",
"@angular/material": "~17.2.1",
"@angular/platform-browser": "~17.1.0",
"@angular/platform-browser-dynamic": "~17.1.0",
"@angular/router": "~17.1.0",
"@nestjs/common": "^10.0.2",
"@nestjs/core": "^10.0.2",
"@nestjs/jwt": "^10.2.0",
"@nestjs/mapped-types": "*",
"@nestjs/mongoose": "^10.0.4",
"@nestjs/platform-express": "^10.0.2",
"@nestjs/swagger": "^7.3.0",
"@nrwl/angular": "^18.0.5",
"axios": "^1.6.0",
"mongoose": "^8.2.1",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.14.3"
},
"devDependencies": {
"@angular-devkit/build-angular": "^17.2.2",
"@angular-devkit/core": "~17.1.0",
"@angular-devkit/schematics": "~17.1.0",
"@angular-eslint/eslint-plugin": "~17.0.0",
"@angular-eslint/eslint-plugin-template": "~17.0.0",
"@angular-eslint/template-parser": "~17.0.0",
"@angular/cli": "~17.1.0",
"@angular/compiler-cli": "~17.1.0",
"@angular/language-service": "~17.1.0",
"@angular/material": "^17.2.1",
"@nestjs/schematics": "^10.0.1",
"@nestjs/testing": "^10.0.2",
"@nx/eslint": "18.0.3",
"@nx/eslint-plugin": "18.0.3",
"@nx/jest": "18.0.5",
"@nx/js": "18.0.5",
"@nx/nest": "^18.0.3",
"@nx/node": "18.0.3",
"@nx/web": "18.0.3",
"@nx/webpack": "18.0.3",
"@nx/workspace": "18.0.3",
"@schematics/angular": "~17.1.0",
"@swc-node/register": "~1.8.0",
"@swc/core": "~1.3.85",
"@swc/helpers": "~0.5.2",
"@types/jest": "^29.4.0",
"@types/node": "~18.16.9",
"@typescript-eslint/eslint-plugin": "^6.13.2",
"@typescript-eslint/parser": "^6.13.2",
"eslint": "~8.48.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-cypress": "^2.13.4",
"jest": "^29.4.1",
"jest-environment-jsdom": "^29.4.1",
"jest-environment-node": "^29.4.1",
"jest-preset-angular": "~13.1.4",
"jsonc-eslint-parser": "^2.1.0",
"nx": "18.0.3",
"prettier": "^2.6.2",
"ts-jest": "^29.1.0",
"ts-node": "10.9.1",
"typescript": "~5.3.2",
"webpack-cli": "^5.1.4"
}
}
Change next two fields in your package.json
"@angular/compiler": "~17.1.0",
"@angular/localize": "^17.1.3",
to
"@angular/compiler": "^17.1.0",
"@angular/localize": "^17.1.0",
and run npm install
.