Error: Cannot find module 'prettier/parser-babel'
See original GitHub issueI don’t know exactly why this happens, but when running prettier via eslint --fix I got this error.
the error is trown by prettier-plugin-import-sort/src/index.js line
const { parsers: javascriptParsers } = _interopDefault(
require('prettier/parser-babel')
)
even I’m using TS
below is my conf on package.json
"importSort": {
".ts, .tsx": {
"style": "renke",
"parser": "typescript"
}
},
and my lint-staged config which is firing the eslint --fix
"lint-staged": {
"*.{js,ts,tsx,jsx}": [
"eslint --fix"
]
},
EDIT: Even if I run $(npm bin)/prettier
manually, the same error happens
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Cannot find module 'prettier' - node.js - Stack Overflow
Prettier is a peer dependency of @vue/eslint-config-prettier so you need to add it to your own dependencies:
Read more >Cannot find module 'prettier' error | bobbyhadz
To solve the error "Cannot find module 'prettier'", make sure to install the prettier package by opening your terminal in your project's root...
Read more >babel-prettier-parser - npm
Prettier parser that allows for parsing of experimental syntax transformed by Babel. Latest version: 0.10.8, last published: 7 months ago.
Read more >Cannot find module 'prettier' error [Solved] - Reactgo
The “Cannot find module 'prettier'” error occurs due to one of the following reasons: The module is not installed in the correct project…...
Read more >Plugins - Prettier
When plugins cannot be found automatically, you can load them with: ... location of global npm modules, or any arbitrary directory that contains...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@c10b10 Had the same issue just now. The mistake was that I hadn’t used the right format for the
importSort
config inpackage.json
. It doesn’t tell you if it’s malformed and then falls back tonode_modules/eslint/lib/api.js
as the style, which doesn’t work.Not working
Working
I have received the same error and it was resolved by updating to prettier: ^2.x.x (previously was on prettier 1.x.x).