解决:ERESOLVE unable to resolve dependency tree

Solution to NPM version error report

When installing project dependencies, it is very likely that the installation will not be successful. There is a big reason for this, which may be caused by your npm version.

1.npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree

2.ERESOLVE unable to resolve dependency tree

3. As shown in the figure:

4. The reason for the error

In newer versions of npm, by default npm install will fail when encountering conflicting peerDependencies.

5. Solutions

Use --force or --legacy-peer-deps to resolve this situation.

        --force will ignore the conflict, and forcibly obtain the remote npm library resources, and overwrite the original version when there is a resource conflict.

        The --legacy-peer-deps flag was introduced in v7 to bypass the automatic installation of peerDependency; it tells NPM to ignore the same modules but different versions of the modules introduced in the project and continue to install, ensuring that each import The dependencies of different versions of the modules used by itself coexist.

 It is recommended to use --legacy-peer-deps to be safer

Type in terminal

npm install --legacy-peer-deps

Press Enter to solve

Guess you like

Origin blog.csdn.net/weixin_61465100/article/details/126528236