eslint报错,别慌: Failed to load plugin ‘@typescript-eslint/eslint-plugin‘ declared in ‘.eslintrc.js_[plugin:vite-plugin-eslint] failed to load parser
遇到的错误表明插件 @typescript-eslint/eslint-plugin
未正确加载,问题可能与插件或 ESLint 配置的过时或不兼容版本有关。
1. 确保正确安装依赖项
npmnpm install @typescript-eslint/eslint-plugin @typescript-eslint/parser --save-devyarnyarn add @typescript-eslint/eslint-plugin @typescript-eslint/parser --dev
要绕过冲突的对等依赖项检查,可以使用 --legacy-peer-deps
标志安装所需的依赖项。此标志将允许 npm 安装依赖项,而不管对等冲突如何:
npm install @typescript-eslint/eslint-plugin@5.0.0 @typescript-eslint/parser@5.0.0 --save-dev --legacy-peer-deps
3.注意安装过程中是否存在漏洞
存在漏洞修复:
npm audit fix --force
按上述即可修复!