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?
Try these steps:
In case you want to have eslint, try checking if you have in your devDependencies the line below:
"eslint": "5.6.0"
I had this issue while using a create-react-app. React scripts already come with an eslint version installed and that means you shouldn't need to install eslint on your own. I fixed this issue by doing the following:
npm install
npm start
and everything was working fine againDeleted node-modules folder
Deleted my package-lock.json file
Removed eslint from the package.json file
Installed all packages again
npm install
npm start
and everything was working fine again
Easy fix #1
npm i -D --save eslint-loader
Easy fix #2
npm i -D --save [email protected]
Explanation:
eslint-loader/index.js
(so not eslint
). eslint-loader
and check the version in its package.json
. It's probably quite outdated. Mine was at 1.9.0, while the current version of eslint-loader
is 4.0.2eslint/lib/formatters/stylish
to eslint/lib/formatters/<some-other-folder>/stylish
in a newer version of eslint (I think v6). And now this older eslint-loader version is failing to find the updated path in eslint.So either upgrading eslint-loader
to a newer version that knows this new path (Easy fix 1), or downgrading eslint
down to when it had that old path (Easy fix 2), should both work.
For the record I think this outdated dependency is coming from webpack, which makes it difficult to debug for the create-react-app folks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With