42

I'm new to react. I'm following the tutorial steps installing node. However, when I run npm start, errors keep show up.

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...

npm install eslint-plugin-import -g

npm WARN [email protected] requires a peer of [email protected] - 4.x but none was installed.

+ [email protected]

System info

eslint --version
v4.2.0

npm -v
5.2.0

npm list -g | grep eslint
├─┬ [email protected]
│ ├─┬ [email protected]
├─┬ [email protected]
│ ├─┬ [email protected]
│ ├─┬ [email protected]
├─┬ [email protected]
3
  • can you pls post your .eslintrc and webpack.config files Commented Jul 13, 2017 at 9:24
  • isntalling 'esling-plugin-import' solved the error mentioned in the questoin. However, it keeps failing at loading elint modules namely eslint-plugin-flowtype, eslint-plugin-jsx-ally.... Commented Jul 13, 2017 at 17:31
  • Yep, it seems that i still need to install eslint-plugin-flowtype and eslint-plugin-jsx-a11y Commented Jul 14, 2017 at 1:34

5 Answers 5

39

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

npm install eslint-plugin-import --save-dev

?

Edit -Solution:

Instead of installing eslint packages one after another, the problem can be alleviated by

npm install react-scripts

as react-scripts is taking care of webpack, babel and eslint and the dependencies thereof.

This may avoid conflicts, as in your case.

Sign up to request clarification or add additional context in comments.

Comments

9

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. 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

Comments

7

Try this

npm install -g eslint

then

eslint --init

1 Comment

After the messages from eslint --init, I tried to reinstall the packages it mentionned, globally since it installed it locally. There still was a missing dependency for eslint-plugin-import which I added. I ended to this, which works (at least for me): npm -g install eslint eslint-plugin-node eslint-plugin-standard eslint-plugin-promise eslint-config-standard eslint-plugin-import
0

I experienced this while running create-react-app after a successful npm install. Bringing down the npm version from v5.2 to v4.6.1 fixed this for me.

Comments

0

enter image description here

Use this

npm install eslint-plugin-import --save-dev
npm i eslint-plugin-jasmine --save-dev
npm i eslint-plugin-sonarjs --save-dev
npm i eslint-plugin-switch-case --save-dev
npm i eslint-plugin-unicorn --save-dev
npm i @angular-eslint/eslint-plugin --save-dev

then Hit ng lint

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.