eslint error - Cannot find module '@ljharb/eslint-config'
InsightUI opened this issue ยท 3 comments
kcd-scripts
version: 0.37.0node
version: 9.11.1npm
version: 5.3.0
What you did:
Create fresh copy of create-react-app
install kcd-scripts as dev dependency
Add lint script to package.json
"lint": "kcd-scripts lint"
What happened:
Cannot find module '@ljharb/eslint-config'
Referenced from: C:\Node\test-project\node_modules\array-includes\.eslintrc
Error: Cannot find module '@ljharb/eslint-config'
Referenced from: C:\Node\test-project\node_modules\array-includes\.eslintrc
at ModuleResolver.resolve (C:\Node\test-project\node_modules\kcd-scripts\node_modules\eslint\lib\util\module-resolve
r.js:74:19)
Reproduction repository:
I created a fresh copy of react-react-app
npx create-react-app test-project
No need for a production repo
Problem description:
I don't see @ljharb/eslint-config
referenced in the internal eslint config for kcd-scripts so I don't know where this error is coming from. I can only assume it has something to do with array-includes package but I'm not 100%
Suggested solution:
I do not have a suggested solution at this time.
You must have an eslintIgnore
in your package.json
that explicitly ignores node_modules
. You can also have an .eslintignore
file that ignores node_modules
. It's a bug in eslint that I reported and tried to fix but there were a bunch of other things they needed to do before merging my PR and I guess they never got to it. Sorry.
No problem. Thanks for the quick reply.
If someone got here as well as me - it also may happen if u accidentally added files from node_modules to git index and trying to commit using husky+lint-staged