javascript - 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:\Users\Leo\AppData\Local\npm-cache\eresolve-report.txt for
a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Leo\AppData\Local\npm-cache\_logs\2021-08-07T10_27_10_092Z-debug.log
解决方案
根据您的日志,npm install
似乎 type-fest 依赖项存在问题。您可以尝试运行npm install --save type-fest
以将其保存到您的依赖项中,然后重试。
推荐阅读
- c++ - 模棱两可的 fread()/fwrite() 文档
- continuous-integration - 如何定期运行 gitlab 阶段?
- ruby-on-rails - 访问管理属性和管理?ruby on rails中的方法
- mdx - 如何从 MDX 中的日期级别提取月、年和日期
- mysql - 连接三个联结表
- qt - ALSA 的 .asoundrc 的默认值是什么?
- python - ModuleNotFoundError:没有名为“torch.nn”的模块;“火炬”不是 Mac OS 上的软件包
- json - 在 Powershell 中使用 Json 变量
- java - 使用 JPA 导致无限循环的 OneToMany 关系
- mysql - 与多个表有多对多关系 1-> 2.1, 2.2, 2.3