Resolving dependency conflict for npm install in Angular application - node.js

I had several error messages for overriding peer dependencies when doing an npm install. After following the steps proposed by the accepted solution to this post. The most essential part being change the ~ versions to ^, remove node_modules and (if it exists) package-lock.json and run npm install again. I have now reduced the error message to the following :
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: console#0.0.0
npm ERR! Found: tslib#2.4.0
npm ERR! node_modules/tslib
npm ERR! tslib#"^2.0.3" from the root project
npm ERR! tslib#"^2.0.0" from #angular/cdk#10.2.7
npm ERR! node_modules/#angular/cdk
npm ERR! #angular/cdk#"^10.2.0" from the root project
npm ERR! peer #angular/cdk#">=9.0.0" from mat-table-exporter#9.1.2
npm ERR! node_modules/mat-table-exporter
npm ERR! mat-table-exporter#"^9.0.2" from the root project
npm ERR! 1 more (#angular/material)
npm ERR! 6 more (#angular/common, #angular/core, #angular/material, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer tslib#"^1.10.0" from mat-table-exporter#9.1.2
npm ERR! node_modules/mat-table-exporter
npm ERR! mat-table-exporter#"^9.0.2" 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.
npm ERR!
npm ERR! See /my/path/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /my/path/.npm/_logs/2022-07-21T15_27_07_820Z-debug-0.log
How do I solve this dependency issue? I cannot simply use --force or --legacy-peer-deps because my next step afterwards is moving from Angular 10 to 13. I tried doing the upgrade without fixing this issue and it forces #angular/cdk to remain at 10.x.x

Related

npm run dev not working with webpack/babel conflict

I am trying to run npm run dev for a Vue project but I keep getting the following output:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: babel-loader#7.1.5
npm ERR! Found: webpack#5.75.0
npm ERR! node_modules/webpack
npm ERR! peer webpack#"^5.0.0" from css-loader#6.7.2
npm ERR! node_modules/css-loader
npm ERR! dev css-loader#"^6.7.2" from the root project
npm ERR! peer webpack#"^5.20.0" from html-webpack-plugin#5.5.0
npm ERR! node_modules/html-webpack-plugin
npm ERR! dev html-webpack-plugin#"^5.5.0" from the root project
npm ERR! 8 more (postcss-loader, terser-webpack-plugin, url-loader, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer webpack#"2 || 3 || 4" from babel-loader#7.1.5
npm ERR! node_modules/babel-loader
npm ERR! dev babel-loader#"^7.1.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: webpack#4.46.0
npm ERR! node_modules/webpack
npm ERR! peer webpack#"2 || 3 || 4" from babel-loader#7.1.5
npm ERR! node_modules/babel-loader
npm ERR! dev babel-loader#"^7.1.1" 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.
I have no idea what to do, I have tried uninstalling vue-cli and tried re-installing it (I'm not sure if this messed up my packages). Is there a way to cleanly delete everything and start fresh? If anyone can help that would be much appreciated!
Update:
I tried starting a new project with vue init webpack frontend in a new folder and tried installing axios and am getting the following error
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: vuex#4.1.0
npm ERR! Found: vue#2.7.14
npm ERR! node_modules/vue
npm ERR! vue#"^2.5.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vue#"^3.2.0" from vuex#4.1.0
npm ERR! node_modules/vuex
npm ERR! vuex#"^4.1.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: vue#3.2.45
npm ERR! node_modules/vue
npm ERR! peer vue#"^3.2.0" from vuex#4.1.0
npm ERR! node_modules/vuex
npm ERR! vuex#"^4.1.0" 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.
I recently updated my version of node (v19.1.0) and npm (v8.19.3), could that be an issue? It generally seems like I am getting a bunch of conflicts every time I try to install new packages. Is there a way to just start clean?
Probably one of your packages is outdated, according to the error. I guess it's the babel loader.
Method 1 Upgrading or Updating your packages might solve the dependency error.
Method 2 Try running npm install --force or npm install --legacy-peer-deps. It should work.

Getting Errors while creating new Project in Angular , after removing node-modules and package-lock.json, getting run time errors

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: angular-front-end#0.0.0
npm ERR! Found: jasmine-core#3.4.0
npm ERR! node_modules/jasmine-core
npm ERR! dev jasmine-core#"~3.4.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer jasmine-core#">=3.8" from karma-jasmine-html-reporter#1.7.0
npm ERR! node_modules/karma-jasmine-html-reporter
npm ERR! dev karma-jasmine-html-reporter#"^1.4.0" 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.
npm ERR!
npm ERR! See C:\Users\kurum\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\kurum\AppData\Local\npm-cache_logs\2022-06-25T12_48_31_942Z-debug-0.log
Package install failed, see above.
Remove your node_modules folder and package-lock.json first.
Then try this command:
npm install --legacy-peer-deps
This command tells NPM to ignore peer deps and proceed with the installation anyway.

Dependancy Angular error with npm install

I used npm install on angular but i get this error. I don't have idea for resolution.
I'm trying to deleted node_module and reinstall but i get same problem.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: lopticienne#0.0.0
npm ERR! Found: #angular/common#12.2.16
npm ERR! node_modules/#angular/common
npm ERR! #angular/common#"~12.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer #angular/common#"^9.1.12" from ng-image-slider#2.8.0
npm ERR! node_modules/ng-image-slider
npm ERR! ng-image-slider#"^2.8.0" 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.
npm ERR!

While Migrating MaterialUI from V4 to V5: Dependency issue: not able to resolve

I'm rather new to upgrading dependencies on my local machine. I'm trying to upgrade MaterialUI using NPM from V4 to V5.
The moment I enter the code: npm install #mui/material #mui/styles, it gives me this huge error.
If someone could please guide me through this, that will be great.
PS C:\Users\rprua564\Documents\autobots-dashboard-appstatic> npm install #mui/material #mui/styles
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: autobots-next-appstatic#0.1.0
npm ERR! Found: react#18.1.0
npm ERR! node_modules/react
npm ERR! react#"^18.1.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^17.0.0" from #mui/styles#5.8.0
npm ERR! node_modules/#mui/styles
npm ERR! #mui/styles#"^5.8.0" 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.
npm ERR!
npm ERR! See C:\Users\rprua564\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\rprua564\AppData\Local\npm-cache\_logs\2022-05-22T20_15_01_551Z-debug.log

Errors in dependency tree every time I install a fresh react-app

It is been a while that I am getting an error every time I create a react app.
I tried to remove all node/npm versions and I reinstall a clean one with the latest node LTS, however, I am still getting the below error
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: type-fest#0.21.3
npm ERR! node_modules/type-fest
npm ERR! type-fest#"^0.21.3" from ansi-escapes#4.3.2
npm ERR! node_modules/ansi-escapes
npm ERR! ansi-escapes#"^4.2.1" from #jest/core#26.6.3
npm ERR! node_modules/#jest/core
npm ERR! #jest/core#"^26.6.0" from jest#26.6.0
npm ERR! node_modules/jest
npm ERR! peer jest#"^26.0.0" from jest-watch-typeahead#0.6.1
npm ERR! node_modules/jest-watch-typeahead
npm ERR! 1 more (react-scripts)
npm ERR! 1 more (jest-cli)
npm ERR! ansi-escapes#"^4.3.1" from jest-watch-typeahead#0.6.1
npm ERR! node_modules/jest-watch-typeahead
npm ERR! jest-watch-typeahead#"0.6.1" from react-scripts#4.0.3
npm ERR! node_modules/react-scripts
npm ERR! react-scripts#"^4.0.3" from the root project
npm ERR! 2 more (jest-watcher, terminal-link)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional type-fest#"^0.13.1" from #pmmmwh/react-refresh-webpack-plugin#0.4.3
npm ERR! node_modules/#pmmmwh/react-refresh-webpack-plugin
npm ERR! #pmmmwh/react-refresh-webpack-plugin#"0.4.3" from react-scripts#4.0.3
npm ERR! node_modules/react-scripts
npm ERR! react-scripts#"^4.0.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.
npm ERR!
npm ERR! See /Users/johnnys/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/johnnys/.npm/_logs/2021-07-10T18_33_36_275Z-debug.log
You are getting the same type of error from a similar post about this issue npm audit fix --force never able to avoid vulnerabilities
There is also a closed ticket in GitHub create-react-app repo. Here is one of the answers:
Hi,
ensure that
your dependencies (including NodeJS/npm/npx/yarn) are up-to-date
ensure that CRA is not installed globally Follow
https://create-react-app.dev/docs/getting-started/ guide to get
started
You need probably keep updating the dependecies to the latest version and wait untill the latest release fix this issue.

Resources