Error: Failed to load plugin prettier: Cannot find module 'eslint-plugin-prettier'
Error: Failed to load plugin prettier: Cannot find module 'eslint-plugin-prettier'
I always get the above error when using eslint-plugin-prettier.
"devDependencies": {
"eslint": "^6.6.0",
"eslint-config-prettier": "^6.10.1",
"eslint-plugin-prettier": "^3.1.2",
"prettier": "2.0.4"
}
Please sign in to leave a comment.
What do your eslint settings look like? Please share a screenshot of Settings | Languages & Frameworks | JavaScript | Code Quality Tools | ESLint page
My package was pointing to a non existing global - this helped me figure it out. Thanks
hi Damanirohan, can you please elaborate your response? What is a non-existing global?

Elena Pogorelova, I have attached a screenshot of my code quality settings for JS -
What does your project look like, is it a monorepo? Do you have eslint-plugin-prettier installed next to eslint?
Yes Elena Pogorelova, it is a monorepo and yes I have `eslint-plugin-prettier` installed next to `eslint`. I have the following eslint packages installed.
These are specified on a package.json that is part of a package in the monorepo.
<root>
- apps
- testApp
- package.json - contains the eslint packages as dependency
- .eslintrc.js
- package.json
If the error only occurs when using ESLint integration in the IDE and doesn't occur when you run the linter in the terminal, it can be caused by the wrong working directory being used. With monorepos, the IDE can start multiple ESlint processes - by default, it starts a separate process for each
package.json
witheslint
dependency and processes everything below it, using the.eslintrc.*
configuration file nearest to the current file. Also, with Automatic configuration, the ESlint working folder is set to a folder where the nearest.eslintrc
oreslintignore
resides (as described in https://www.jetbrains.com/help/webstorm/eslint.html#ws_js_eslint_manual_configuration)You can try changing the configuration to Manual and choosing the eslint package, configuration file and working directory explicitly to match the command you use when running the linter in terminal
This is really insightful Elena Pogorelova. My other devs do not seem to have the issue but I will give it a try nonetheless and post the update here.