ReactJS:无法加载在 'package.json : Cannot find module './eslint-utils 中声明的插件 'testing-library'
ReactJS : Failed to load plugin 'testing-library' declared in 'package.json : Cannot find module './eslint-utils'
我最近将一些代码库从我的一台设备复制粘贴到另一台设备。我复制了所有内容,包括节点模块文件夹。
现在,当我 运行 我的 React 应用程序出现错误时
npm start
Failed to load plugin 'testing-library' declared in 'package.json » eslint-config-react-app/jest': Cannot find module './eslint-utils'
Require stack:
- C:\Users\hpoddar\Desktop\WebDev\react-redux-demo\node_modules\eslint-plugin-testing-library\node_modules\@typescript-eslint\experimental-utils\dist\ast-utils\index.js
- C:\Users\hpoddar\Desktop\WebDev\react-redux-demo\node_modules\eslint-plugin-testing-library\node_modules\@typescript-eslint\experimental-utils\dist\index.js
- C:\Users\hpoddar\Desktop\WebDev\react-redux-demo\node_modules\eslint-plugin-testing-library\rules\await-async-query.js
- C:\Users\hpoddar\Desktop\WebDev\react-redux-demo\node_modules\eslint-plugin-testing-library\index.js
- C:\Users\hpoddar\Desktop\WebDev\react-redux-demo\node_modules\@eslint\eslintrc\lib\config-array-factory.js
- C:\Users\hpoddar\Desktop\WebDev\react-redux-demo\node_modules\@eslint\eslintrc\lib\index.js
- C:\Users\hpoddar\Desktop\WebDev\react-redux-demo\node_modules\eslint\lib\cli-engine\cli-engine.js
- C:\Users\hpoddar\Desktop\WebDev\react-redux-demo\node_modules\eslint\lib\cli-engine\index.js
- C:\Users\hpoddar\Desktop\WebDev\react-redux-demo\node_modules\eslint\lib\api.js
- C:\Users\hpoddar\Desktop\WebDev\react-redux-demo\node_modules\eslint-webpack-plugin\dist\getESLint.js
- C:\Users\hpoddar\Desktop\WebDev\react-redux-demo\node_modules\eslint-webpack-plugin\dist\linter.js
- C:\Users\hpoddar\Desktop\WebDev\react-redux-demo\node_modules\eslint-webpack-plugin\dist\index.js
- C:\Users\hpoddar\Desktop\WebDev\react-redux-demo\node_modules\eslint-webpack-plugin\dist\cjs.js
- C:\Users\hpoddar\Desktop\WebDev\react-redux-demo\node_modules\react-scripts\config\webpack.config.js
- C:\Users\hpoddar\Desktop\WebDev\react-redux-demo\node_modules\react-scripts\scripts\start.js
所以我尝试使用 npm install
重新安装所有依赖项,但这也没有用。
我该如何解决?
如果您复制了包括节点模块在内的所有内容,请尝试删除节点模块并重新安装,因为复制该文件夹可能会导致问题。
解决我的代码之前是:
<Link className="decoration" href="/" color="inherit">
Contact
</Link>
我更改 href:
<Link className="decoration" to="/" color="inherit">
Contact
</Link>
我最近将一些代码库从我的一台设备复制粘贴到另一台设备。我复制了所有内容,包括节点模块文件夹。 现在,当我 运行 我的 React 应用程序出现错误时
npm start
Failed to load plugin 'testing-library' declared in 'package.json » eslint-config-react-app/jest': Cannot find module './eslint-utils'
Require stack:
- C:\Users\hpoddar\Desktop\WebDev\react-redux-demo\node_modules\eslint-plugin-testing-library\node_modules\@typescript-eslint\experimental-utils\dist\ast-utils\index.js
- C:\Users\hpoddar\Desktop\WebDev\react-redux-demo\node_modules\eslint-plugin-testing-library\node_modules\@typescript-eslint\experimental-utils\dist\index.js
- C:\Users\hpoddar\Desktop\WebDev\react-redux-demo\node_modules\eslint-plugin-testing-library\rules\await-async-query.js
- C:\Users\hpoddar\Desktop\WebDev\react-redux-demo\node_modules\eslint-plugin-testing-library\index.js
- C:\Users\hpoddar\Desktop\WebDev\react-redux-demo\node_modules\@eslint\eslintrc\lib\config-array-factory.js
- C:\Users\hpoddar\Desktop\WebDev\react-redux-demo\node_modules\@eslint\eslintrc\lib\index.js
- C:\Users\hpoddar\Desktop\WebDev\react-redux-demo\node_modules\eslint\lib\cli-engine\cli-engine.js
- C:\Users\hpoddar\Desktop\WebDev\react-redux-demo\node_modules\eslint\lib\cli-engine\index.js
- C:\Users\hpoddar\Desktop\WebDev\react-redux-demo\node_modules\eslint\lib\api.js
- C:\Users\hpoddar\Desktop\WebDev\react-redux-demo\node_modules\eslint-webpack-plugin\dist\getESLint.js
- C:\Users\hpoddar\Desktop\WebDev\react-redux-demo\node_modules\eslint-webpack-plugin\dist\linter.js
- C:\Users\hpoddar\Desktop\WebDev\react-redux-demo\node_modules\eslint-webpack-plugin\dist\index.js
- C:\Users\hpoddar\Desktop\WebDev\react-redux-demo\node_modules\eslint-webpack-plugin\dist\cjs.js
- C:\Users\hpoddar\Desktop\WebDev\react-redux-demo\node_modules\react-scripts\config\webpack.config.js
- C:\Users\hpoddar\Desktop\WebDev\react-redux-demo\node_modules\react-scripts\scripts\start.js
所以我尝试使用 npm install
重新安装所有依赖项,但这也没有用。
我该如何解决?
如果您复制了包括节点模块在内的所有内容,请尝试删除节点模块并重新安装,因为复制该文件夹可能会导致问题。
解决我的代码之前是:
<Link className="decoration" href="/" color="inherit">
Contact
</Link>
我更改 href:
<Link className="decoration" to="/" color="inherit">
Contact
</Link>