ERESOLVE 报出来的时候,先看清它到底在抱怨什么 装个包,终端突然甩出一大段红字: npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: my-app@1.0.0 npm ERR! Found: react@18.2.0 npm ERR! node_modules/react npm ERR! react@"^18.2.0" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer react@"^17.0.0" from some-old-lib@2.1.0 很多人看到 unable to resolve dependency tree 就慌,第一反应是搜"npm install 报错怎么办",然后照着某篇帖子敲 --force。但这段红字其实把话说得很清楚了:你的项目里 React 是 18,某个老库声.... 有更新 npm install 报 ERESOLVE:先读懂红字里的冲突两端,再决定要不要加 legacy-peer-deps(2026) AI 工具