Error: Cannot find module 'eslint/lib/rules/no-unused-expressions'

SyedKhizer picture SyedKhizer · Oct 23, 2018 · Viewed 10.4k times · Source

After installing ESLint through NPM, I'm getting the following error in my browser:

Error: Cannot find module 'eslint/lib/rules/no-unused-expressions' Referenced from:

Any idea what could cause this and how I can fix it?

Answer

Roger Oliveira picture Roger Oliveira · Oct 24, 2018

Try these steps:

  1. Delete package-lock.json file
  2. Delete node_modules folder
  3. Delete .eslintrc file
  4. Remove devDependencies that contains 'eslint'
  5. In the terminal type: npm install
  6. In the terminal type: npm run start

In case you want to have eslint, try checking if you have in your devDependencies the line below:

"eslint": "5.6.0"
  1. NPM INSTALL ESLINT