[SOLVED] Npm ERR code ERESOLVE unable to resolve dependency tree install error in react/angular
Feb 12, 2025
Get the full source code of application here:
Hi Join the official discord server to resolve doubts here:
https://discord.gg/cRnjhk6nzW
Visit my Online Free Media Tool Website
https://freemediatools.com/
Buy Premium Scripts and Apps Here:
https://procodestore.com/
Show More Show Less View Video Transcript
0:00
uh hello guys welcome to this video so
0:02
in this video I will show you how to fix
0:04
this error whenever you install any
0:06
third party nodejs package inside your
0:08
angular react or View application this
0:11
error message comes right here which is
0:13
error resolve unable to resolve
0:15
dependency tree so while resolving this
0:18
third party pack essentially this
0:21
conflicts whatever that you are using
0:24
your npm version so it conflicts with
0:27
the third party package that you're
0:29
trying to install so there is a specific
0:31
command that you can set to ignore this
0:34
warning or error so let me show you so
0:39
basically I am inside my angular project
0:41
and I need to install this third party
0:44
package which is ngx image
0:47
Cropper so as I'm writing this command
0:50
here I'm getting this error
0:53
message you can see that so unable to
0:56
resolve dependency tree so it is
0:59
conflicting with this version number
1:02
that I'm using one of the dependencies
1:04
angular so now to fix this error it
1:08
actually tells you this right here
1:10
either we can pass this flag dash dash
1:13
force or we can set this Legacy P
1:16
dependency so first of all the easy way
1:19
to actually install this will be to dash
1:23
F so just pass this Das F flag which
1:27
will
1:28
force this uh
1:30
package to be installed
1:33
without
1:35
uh it will ignore everything and install
1:38
this package so if you just do this
1:42
essentially this package which which uh
1:44
it will be installed so this is the
1:46
first way of resolving this error you
1:49
can pass this- F flag so
1:53
the so the package will be installed but
1:56
there is one disadvantage of using this
1:59
approach because every time you want to
2:01
install a third party package which is
2:02
not supported you need to every time
2:05
pass this- F flag so it will kind of
2:08
repeat it itself so you if you don't
2:11
want to
2:12
repeat this you can use the second way
2:16
so second way is simply you need to set
2:19
a this command here so let me zoom in
2:23
npm config set
2:27
Legacy Das p
2:30
D
2:31
DS and you just need to set this value
2:34
to be true so let me zoom in so just see
2:38
npm config set Legacy Das peer-
2:45
DS and you need to set this value to be
2:49
true so this essentially mean that we
2:51
are setting all the Legacy perer
2:53
dependencies to be true in other words
2:56
we are neglecting all the warnings or
2:58
error message that will occur whenever
3:00
you try
3:01
to uh install the old package so you
3:05
just need to set this and enter it and
3:08
now after you install any third party
3:11
package
3:13
here so ngx image
3:16
Cropper so if I install you can see it
3:19
will get
3:21
installed so same thing goes with this
3:23
is angular project and same thing you
3:25
can do this with react project as well
3:27
so this is a react project and you will
3:30
see as I'm trying to install this
3:32
package npm install react select at
3:35
theate version 2 this is the old package
3:38
so same error will come right here as
3:41
well so I've already set that value to
3:45
be so let me set it to
3:52
false so same error will come in react
3:54
project as well this is again unable to
3:57
resolve dependency tree if you want to
3:59
inst a old version package so again you
4:02
need to either you can pass dasf this
4:07
will also resolve the
4:10
error but one dis Advantage is that you
4:13
again need to pass dasf in every package
4:16
install so what you can do you can set
4:20
the global variable that I showed
4:24
you
4:25
so you can set this option npm config
4:29
set set Legacy
4:31
per so you can set this option to
4:36
true and then install
4:38
this so it will work without that F flag
4:42
so it will get installed you will see
4:44
that so in this easy way guys you can
4:46
resolve this error message so I
4:50
personally face this error message a lot
4:52
while working with different packages
4:54
different versions so it's a very good
4:56
fix you can apply and it it will save
5:00
you a lot of time because this message
5:02
occurs in various situations while
5:05
you're are working with different
5:06
packages so thank you very much for
5:09
watching this video and also check out
5:11
my website as well free mediat tools.com
5:13
uh which contains thousands of tools
5:16
regarding audio video and MH and I will
5:20
be seeing you guys in the next video
#Computers & Electronics
