Failed to load plugin import: 'eslint-plugin-import'

Viewed 48070

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 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
5 Answers

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

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.

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

Related