高效码农

macOS执行yarn install 报错

报错信息

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: @typescript-eslint/eslint-plugin@4.1.1
npm ERR! node_modules/@typescript-eslint/eslint-plugin
npm ERR!   dev @typescript-eslint/eslint-plugin@"4.1.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @typescript-eslint/eslint-plugin@"2.x" from eslint-config-react-app@5.2.1
npm ERR! node_modules/eslint-config-react-app
npm ERR!   dev eslint-config-react-app@"^5.2.1" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

错误原因:

node版本错误,npm版本错误

解决方案:

更换与之相匹配的node版本,为了方便管理node;需要安装nvm;

安装后切换nvm use [node版本号] :切换到指定版本 node

当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »