[npm error]: npm ERR! code ERESOLVE, npm ERR! ERESOLVE could not resolve problems

  • Friends who have used npm will have a situation where npm install /npm install xxxx will cause a series of errors, as follows:

  • Solution: Just add --legacy-peer-deps after npm install to solve the problem. The same goes for installing plug-ins.
npm install --legacy-peer-deps
  • The reason, the editor understands: the error will be reported at the beginning because various versions of plug-ins are installed in the original project.Some plug-ins have different versions. Dependency relationship , and npm’s default behavior is to verify peer dependencies. Only when they are met can the installation be successful, otherwise The above error will be reported and the installation will be refused. This is one of the reasons why we sometimes add the @2.x.x version number after a plug-in;Use '--legacy-peer- The deps' flag can change this behavior and the installation can be completed even if the peer dependencies are not met.
  • Note: Frequent use is obviously not recommended, especially when installing new plug-ins.

Guess you like

Origin blog.csdn.net/qq_45796592/article/details/134328061