npm ERR! code ERESOLVE,npm ERR! ERESOLVE unable to resolve dependency tree

Preface

  • When you download the package for the first time or delete node_module, npm i suddenly reports an error. This is caused by the npm version.

  • It may be caused by some package versions being incompatible with npm (peerDependencies)

  • npm ERR! code ERESOLVE,npm ERR!

  • ERESOLVE unable to resolve dependency tree

As shown in the picture

Solution - Use the following command to download the package
npm install --legacy-peer-deps
explain
  • npm install --force

  • --force will ignore conflicts and force the download of npm library resources. When there are resource conflicts, the original version will be overwritten - not recommended

  • npm install --legacy-peer-deps

  • --legacy-peer-deps - tells npm to ignore the problem of the same modules but different versions between the various modules introduced in the project and continue the installation, ensuring that the different versions of the modules used by each introduced dependency coexist.


Summarize:

After this process, I believe you will also have a deep initial impression of npm ERR! code ERESOLVE,npm ERR! ERESOLVE unable to resolve dependency tree, but in actual development, the situations we encounter are definitely different, so we To understand its principle, it will never change without departing from its origin. Come on, hit the workers!

Please point out any deficiencies, thank you - Feng Guo Wuhen

Guess you like

Origin blog.csdn.net/weixin_53579656/article/details/134276695