wesbos / eslint-config-wesbos

No-Sweat™ Eslint and Prettier Setup - with or without VS Code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Running eslint gives error "Error: Cannot find module 'eslint-config-wesbos'"

jameshowelldev opened this issue · comments

I am using this on a Gatsby site so followed the instructions for a project-based install. I ran npx install-peerdeps@v2.0.2 --dev eslint-config-wesbos due to some dependency issues and everything installed successfully.

I then added the lint and lint:fix scripts to my package.json but running either script causes the Terminal to hang. So I ran eslint . and got the error "Error: Cannot find module 'eslint-config-wesbos" which might explain why the scripts weren't running.

I have checked my node_modules and eslint-config-wesbos directory and files are all there. Any ideas?

FWIW I was running into the same issue when I followed the install directions for local setup.

And this fixed my issue:

I noticed that my package.json was missing the peerDependencies that are listed in the package.json file of this project. So I added them all and then ran npm install again to be sure everything was installed.

After that when I ran npm run lint I got an error indicating that I was missing eslint-plugin-html so I ran npm install eslint-plugin-html and then I was able to run npm run lint and now it appears to be working as expected.

I am still getting my bearings with all of this so I am not sure which of these steps actually resulted in the fix. Would love to hear some insight from the more knowledgeable folks out there as to what was actually needed here?