ESLint依赖失败



我想在VSCode上的React项目上使用ESLint,但它不起作用。当我输入

npm install

显示如下:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: type-fest@0.20.2
npm ERR! node_modules/type-fest
npm ERR!   type-fest@"^0.20.2" from globals@13.10.0
npm ERR!   node_modules/@eslint/eslintrc/node_modules/globals
npm ERR!     globals@"^13.9.0" from @eslint/eslintrc@0.4.3
npm ERR!     node_modules/@eslint/eslintrc
npm ERR!       @eslint/eslintrc@"^0.4.3" from eslint@7.32.0
npm ERR!       node_modules/eslint
npm ERR!         dev eslint@"^7.32.0" from the root project
npm ERR!         18 more (@typescript-eslint/eslint-plugin, ...)
npm ERR!   type-fest@"^0.20.2" from globals@13.10.0
npm ERR!   node_modules/eslint/node_modules/globals
npm ERR!     globals@"^13.6.0" from eslint@7.32.0
npm ERR!       dev eslint@"^7.32.0" from the root project
npm ERR!       18 more (@typescript-eslint/eslint-plugin, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional type-fest@"^0.13.1" from @pmmmwh/react-refresh-webpack-plugin@0.4.2
npm ERR! node_modules/@pmmmwh/react-refresh-webpack-plugin
npm ERR!   @pmmmwh/react-refresh-webpack-plugin@"0.4.2" from react-scripts@4.0.1
npm ERR!   node_modules/react-scripts
npm ERR!     react-scripts@"4.0.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.
npm ERR!
npm ERR! See C:UsersLeoAppDataLocalnpm-cacheeresolve-report.txt for 
a full report.
npm ERR! A complete log of this run can be found in:
npm ERR!     C:UsersLeoAppDataLocalnpm-cache_logs2021-08-07T10_27_10_092Z-debug.log

根据您的日志,npm install似乎有一个类型测试依赖的问题。您可以尝试运行npm install --save type-fest将其保存到您的依赖项,然后重试。

最新更新