我的react应用程序出错了,它说:
Line 0: Parsing error: Cannot find module 'eslint-scope' from '/home/path/.cache/yarn/v6/npm-eslint-7.11.0-aaf2d23a0b5f1d652a08edacea0c19f7fadc0b3b-integrity/node_modules/eslint/lib/api.js'
然后我使用以下命令将eslint-scope添加到我的依赖项中:
yarn add eslint-scope
但我发现了很多未满足的对等依赖:
warning " > @testing-library/user-event@12.1.10" has unmet peer dependency "@testing-library/dom@>=7.21.4".
warning " > eslint-config-react-app@6.0.0" has unmet peer dependency "@typescript-eslint/eslint-plugin@^4.0.0".
warning " > eslint-config-react-app@6.0.0" has unmet peer dependency "@typescript-eslint/parser@^4.0.0".
warning " > eslint-config-react-app@6.0.0" has unmet peer dependency "babel-eslint@^10.0.0".
warning " > eslint-config-react-app@6.0.0" has unmet peer dependency "eslint-plugin-flowtype@^5.2.0".
warning " > eslint-config-react-app@6.0.0" has unmet peer dependency "eslint-plugin-import@^2.22.0".
warning " > eslint-config-react-app@6.0.0" has unmet peer dependency "eslint-plugin-jsx-a11y@^6.3.1".
warning " > eslint-config-react-app@6.0.0" has unmet peer dependency "eslint-plugin-react@^7.20.3".
warning " > eslint-config-react-app@6.0.0" has unmet peer dependency "eslint-plugin-react-hooks@^4.0.8".
当我尝试安装其中一个时,我发现另一个未满足的依赖项:
warning " > @testing-library/user-event@12.1.10" has unmet peer dependency "@testing-library/dom@>=7.21.4".
warning " > eslint-config-react-app@6.0.0" has unmet peer dependency "@typescript-eslint/eslint-plugin@^4.0.0".
warning " > eslint-config-react-app@6.0.0" has unmet peer dependency "@typescript-eslint/parser@^4.0.0".
warning " > eslint-config-react-app@6.0.0" has unmet peer dependency "eslint-plugin-flowtype@^5.2.0".
warning " > eslint-config-react-app@6.0.0" has unmet peer dependency "eslint-plugin-import@^2.22.0".
warning " > eslint-config-react-app@6.0.0" has unmet peer dependency "eslint-plugin-jsx-a11y@^6.3.1".
warning " > eslint-config-react-app@6.0.0" has unmet peer dependency "eslint-plugin-react@^7.20.3".
warning " > eslint-config-react-app@6.0.0" has unmet peer dependency "eslint-plugin-react-hooks@^4.0.8".
我可以自动安装所有未满足的依赖项吗?
2条答案
按热度按时间vs3odd8k1#
首先,您应该运行
yarn why eslint-scope
命令,尝试找出为什么需要eslint-scope
。如果你仍然认为它是必要的,那么你应该知道,默认情况下,对等依赖项不再安装。你可以在这里阅读更多。在NPM V7中,peerDependencies是installed automatically again。
现在,您应该尝试使用install-peerdeps包
npx install-peerdeps -Y eslint-scope
szqfcxe22#
另一种解决方法是使用
check-peer-dependencies
npm包(link)示例:
如果您遇到一些问题,如“无法找到版本”,您可以这样做:
注:
check-peer-dependencies
(版本:4.2.0)将安装对等依赖项,但由于某种原因,它会引发错误。