[英]Failed to load plugin import: 'eslint-plugin-import'
I'm new to react.我是新来的反应。 I'm following the tutorial steps installing node.我正在按照教程步骤安装节点。 However, when I run npm start
, errors keep show up.但是,当我运行npm start
,错误不断出现。
Failed to compile.
./src/index.js
Module build failed: Error: Failed to load plugin import: Cannot find module 'eslint-plugin-import'
Referenced from:
at Array.forEach (native)
at Array.reduceRight (native)
Also, I tried to install 'eslint-plugin-import', but in vain...另外,我尝试安装'eslint-plugin-import',但徒劳无功......
npm install eslint-plugin-import -g
npm WARN eslint-plugin-import@2.7.0 requires a peer of eslint@2.x - 4.x but none was installed.
+ eslint-plugin-import@2.7.0
System info系统信息
eslint --version
v4.2.0
npm -v
5.2.0
npm list -g | grep eslint
├─┬ eslint@4.2.0
│ ├─┬ eslint-scope@3.7.1
├─┬ eslint-plugin-import@2.7.0
│ ├─┬ eslint-import-resolver-node@0.3.1
│ ├─┬ eslint-module-utils@2.1.1
├─┬ eslint-plugin-react@7.1.0
The issue is resolved for me after installing the following in a row:连续安装以下内容后,问题已为我解决:
npm install eslint-plugin-import eslint-plugin-flowtype eslint-plugin-jsx-a11y eslint-plugin-react
Have you tried installing eslint
locally, like您是否尝试eslint
在本地安装eslint
,例如
npm install eslint-plugin-import --save-dev
? ?
Edit -Solution:编辑 - 解决方案:
Instead of installing eslint
packages one after another, the problem can be alleviated by可以通过以下方式缓解问题,而不是一个接一个地安装eslint
包
npm install react-scripts
as react-scripts is taking care of webpack
, babel
and eslint
and the dependencies thereof.因为 react-scripts 正在处理webpack
、 babel
和eslint
及其依赖项。
This may avoid conflicts, as in your case.这可以避免冲突,就像您的情况一样。
Try this试试这个
npm install -g eslint
then那么
eslint --init
Run today in the same problem.今天在同样的问题中运行。 Had upgraded ESLint 5.16 to 6.6.0 and had been using the vue-eslint-plugin 5.2.3.已经将 ESLint 5.16 升级到 6.6.0,并且一直在使用 vue-eslint-plugin 5.2.3。 Had to install this packages:必须安装这个包:
npm install eslint-plugin-import --save-dev
npm install eslint-plugin-node --save-dev
npm install eslint-plugin-promise --save-dev
npm install eslint-plugin-standard --save-dev
I experienced this while running create-react-app
after a successful npm install
.我在npm install
成功后运行create-react-app
遇到了这个问题。 Bringing down the npm version from v5.2 to v4.6.1 fixed this for me.将 npm 版本从 v5.2 降低到 v4.6.1 为我解决了这个问题。
Had this same issue too.也有同样的问题。 I solved it by disabling eslint extension for vscode, also removed the .eslintrc file in root and every traces of it in package.json file.我通过禁用 vscode 的 eslint 扩展解决了它,还删除了根目录中的 .eslintrc 文件和 package.json 文件中的所有痕迹。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.