I created an angular application 1 years ago. Now I do an npm install, and it shows me this error. I know I need to do --force.
But why it's happening? I didn't change anything in my application.
I have package-lock.json,, and I think it should download the exact package that installed on the day I created the application.
So why does npm say this package is not compatible with other packages now?
#Why I get could not resolve error on npm install?
7 messages · Page 1 of 1 (latest)
Hello, can you show your package.json file?
Sure the error and package.json:
"dependencies": {
"@angular/animations": "16.2.6",
"@angular/common": "16.2.6",
"@angular/compiler": "16.2.6",
"@angular/core": "16.2.11",
"@angular/forms": "16.2.6",
"@angular/platform-browser": "16.2.6",
"@angular/platform-browser-dynamic": "16.2.6",
"@angular/router": "16.2.6",
"@nx/angular": "16.9.1",
"@rx-angular/state": "16.0.0",
"@types/echarts": "4.9.18",
"@types/uuid": "9.0.2",
"agentkeepalive-ntlm": "1.0.6",
"angular-svg-icon": "16.0.0",
"prettier": "3.0.0",
"rxjs": "7.8.0",
"sql-formatter": "12.2.3",
"tslib": "2.3.0",
"uuid": "9.0.0",
"zone.js": "0.13.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "16.2.0",
"@angular-devkit/core": "16.2.0",
"@angular-devkit/schematics": "16.2.0",
"@angular-eslint/eslint-plugin": "~16.0.0",
"@angular-eslint/eslint-plugin-template": "~16.0.0",
"@angular-eslint/template-parser": "~16.0.0",
"@angular/cli": "~16.2.0",
"@angular/compiler-cli": "16.2.6",
"@angular/language-service": "16.2.6",
"@nx/eslint-plugin": "16.9.1",
"@nx/jest": "16.9.1",
"@nx/js": "16.9.1",
"@nx/linter": "16.9.1",
"@nx/web": "16.9.1",
"@nx/workspace": "16.9.1",
"@schematics/angular": "16.2.0",
"@types/jest": "^29.4.0",
"@types/node": "16.11.7",
"@typescript-eslint/eslint-plugin": "5.60.1",
"@typescript-eslint/parser": "5.60.1",
"eslint": "8.46.0",
"eslint-config-prettier": "8.1.0",
"jest": "^29.4.1",
"jest-environment-jsdom": "^29.4.1",
"jest-preset-angular": "~13.1.0",
"nx": "16.9.1",
"prettier": "^2.6.2",
"ts-jest": "^29.1.0",
"ts-node": "10.9.1",
"typescript": "~5.1.3"
}
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @angular/[email protected]
npm ERR! Found: @angular/[email protected]
npm ERR! node_modules/@angular/core
npm ERR! @angular/core@"16.2.11" from the root project
npm ERR! peer @angular/core@"^16.0.0" from @rx-angular/[email protected]
npm ERR! node_modules/@rx-angular/state
npm ERR! @rx-angular/state@"16.0.0" from the root project
npm ERR! 7 more (angular-svg-icon, jest-preset-angular, ng-apexcharts, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/core@"16.2.6" from @angular/[email protected]
npm ERR! node_modules/@angular/animations
npm ERR! @angular/animations@"16.2.6" from the root project
npm ERR! peerOptional @angular/animations@"16.2.6" from @angular/[email protected]
npm ERR! node_modules/@angular/platform-browser
npm ERR! @angular/platform-browser@"16.2.6" from the root project
npm ERR! 3 more (@angular/forms, @angular/platform-browser-dynamic, @angular/router)
npm ERR!
npm ERR! Conflicting peer dependency: @angular/[email protected]
npm ERR! node_modules/@angular/core
npm ERR! peer @angular/core@"16.2.6" from @angular/[email protected]
npm ERR! node_modules/@angular/animations
npm ERR! @angular/animations@"16.2.6" from the root project
npm ERR! peerOptional @angular/animations@"16.2.6" from @angular/[email protected]
npm ERR! node_modules/@angular/platform-browser
npm ERR! @angular/platform-browser@"16.2.6" from the root project
npm ERR! 3 more (@angular/forms, @angular/platform-browser-dynamic, @angular/router)
error continue:
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 C:\Users\user\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user\AppData\Local\npm-cache\_logs\2024-02-22T09_27_05_821Z-debug-0.log
why does npm say this package is not compatible with other packages now?
Probably because you used npm 6 before, which was more lax than it is now regarding peer dependency conflicts.
But why I do have dependency conflicts? I didn't change anything