This error is related to Windows Line endings being different from Unix ones. Try running npx prettier --write . on your project's directory. This command will tell prettier to fix simple errors (such as this one) when found.

To prevent this error from happening again you can either set "end-of-line" to auto on your .prettierrc file or try setting line endings to "Unix"/LF on your editor: instructions for VSCode and for IntelliJ-based editors

Answer from Leônidas Villeneuve on Stack Overflow
🌐
Prettier
prettier.io › docs › cli
CLI · Prettier
Prettier CLI will ignore files located in node_modules directory. To opt out from this behavior, use --with-node-modules flag. This rewrites all processed files in place. This is comparable to the eslint --fix workflow.
🌐
GitHub
github.com › prettier › prettier › issues › 6280
How do I use the CLI to fix all files? · Issue #6280 · prettier/prettier
July 9, 2019 - If I try prettier --check "*" or prettier --check NOTHING then Prettier seems to completely ignore the .prettierignore file.
Author   octogonz
Discussions

How to get ESLint --fix to also run prettier --write
Right now I need to do prettier --write && eslint --fix and I was hoping I could just run the one command. More on stackoverflow.com
🌐 stackoverflow.com
node.js - prettier command not working even though prettier is in devDependancies - Stack Overflow
Installing a module that includes a CLI program like prettier, nodemon, etc., will place the program in node_modules/.bin. Your terminal shell does not know to look in this folder when you run a command. Type echo $PATH in your terminal to see a list of the folders that are checked when you ... More on stackoverflow.com
🌐 stackoverflow.com
A better Prettier CLI and config file
After a big find-and-replace refactor in src/components you can run prettier format src/components to fix formatting (without having to run on the entire project). ... Note: I think we should ditch built-in support for globs altogether. They’re not needed! If you need globs for a one-off command, ... More on github.com
🌐 github.com
26
November 30, 2019
How to add prettier command before code commit or on save file through devdependencies
22 What is Prettier keyboard shortcut command in VS Code to format only a block of React code, not just format on file autosave? 0 How to fix JSX/React formatting issue with Prettier in VSCode More on stackoverflow.com
🌐 stackoverflow.com
July 5, 2022
🌐
Fishtank
getfishtank.com › insights › running-prettier-from-the-command-line
Running Prettier from the Command Line | Fishtank
March 21, 2023 - Now format all files with Prettier by running - npm run format in your terminal. This command will pick up “format” inside “script” in your project’s package.
🌐
GitHub
github.com › prettier › prettier-eslint
GitHub - prettier/prettier-eslint: Code `prettier` `eslint --fix` Formatted Code :sparkles: · GitHub
This formats your code via prettier, and then passes the result of that to eslint --fix.
Starred by 4.1K users
Forked by 175 users
Languages   TypeScript 92.9% | JavaScript 7.1%
🌐
Prettier
prettier.io › docs › install
Install · Prettier
Formatting from the command line is a good way to get started, but you get the most from Prettier by running it from your editor, either via a keyboard shortcut or automatically whenever you save a file. When a line has gotten so long while coding that it won’t fit your screen, just hit a key and watch it magically be wrapped into multiple lines! Or when you paste some code and the indentation gets all messed up, let Prettier fix ...
🌐
freeCodeCamp
freecodecamp.org › news › dont-just-lint-your-code-fix-it-with-prettier
Don’t just lint your code - fix it with Prettier
November 6, 2019 - If you’ve followed along so far, we now have two commands: lint: which will check your code for you and tell you what's wrong · format: will automatically try to fix the problems for you · When using these in practice, your best bet is to ...
Find elsewhere
🌐
LocalUsr
localusr.com › posts › 2022 › 01 › 3-how-to-fix-prettier-code-style-issues
How to Fix Prettier Code Style Issues :: LocalUsr
This commands will perform the check on the project files based on the config of prettier. It will try to fix the errors and those that it can’t will be shown in the final output.
🌐
GitHub
github.com › prettier › prettier-eslint-cli
GitHub - prettier/prettier-eslint-cli: CLI for prettier-eslint · GitHub
If you provide the argument --prettier-last, it will run eslint --fix first, then prettier. This allows you to use eslint to look for bugs and/or bad practices, and use prettier to enforce code style. prettier-eslint-cli also supports the same ...
Starred by 548 users
Forked by 69 users
Languages   JavaScript
🌐
npm
npmjs.com › package › prettier-eslint-cli
prettier-eslint-cli - npm
July 5, 2023 - If you provide the argument --prettier-last, it will run eslint --fix first, then prettier. This allows you to use eslint to look for bugs and/or bad practices, and use prettier to enforce code style. prettier-eslint-cli also supports the same ...
      » npm install prettier-eslint-cli
    
Published   Oct 14, 2023
Version   8.0.1
Author   Kent C. Dodds
🌐
SheCodes
shecodes.io › athena › 104-how-to-fix-prettier-not-working-in-vs-code
[VS Code] - How to Fix Prettier Not Working in VS Code - | SheCodes
Discover how to fix the Prettier's non-working issue on VS Code. Step-by-step guide with detailed technical help is available.
🌐
LogRocket
blog.logrocket.com › home › using prettier and eslint for javascript formatting
Using Prettier and ESLint for JavaScript formatting - LogRocket Blog
November 30, 2023 - Now, you can run the npm run format command to format and fix all your code in one go. All the major code editors have extensions for ESLint and Prettier.
🌐
Prettier
prettier.io › blog › 2023 › 11 › 30 › cli-deep-dive
Prettier's CLI: A Performance Deep Dive · Prettier
November 30, 2023 - prettier packages --check # 29s prettier packages --check --cache # 20s prettier@next packages --check --no-cache --no-parallel # 7.3s prettier@next packages --check --no-cache # 5.5s prettier@next packages --check # 1.3s · By default times for the same command go from ~29s to ~1.3s, for a ~22x speedup.
🌐
GitHub
github.com › prettier › prettier › issues › 7073
A better Prettier CLI and config file · Issue #7073 · prettier/prettier
November 30, 2019 - After a big find-and-replace refactor in src/components you can run prettier format src/components to fix formatting (without having to run on the entire project). ... Note: I think we should ditch built-in support for globs altogether.
Author   lydell
🌐
Rushjs
rushjs.io › pages › maintainer › enabling_prettier
Enabling Prettier | Rush
July 5, 2023 - # Install prettier so you can invoke it manually npm install --global prettier # Run these commands from your repo root, since "." below refers to the current folder cd my-repo # See what files Prettier will operate on; use this to tune your ...
🌐
GitConnected
levelup.gitconnected.com › how-to-format-all-files-in-a-directory-with-prettier-5f0ff5f4ffb2
How To Format All Files in a Directory with Prettier | by Dr. Derek Austin 🥳 | Level Up Coding
January 21, 2026 - Thankfully, it’s easy to fix the formatting in 5 seconds using Prettier. I usually just use Prettier from inside VS Code (using the prettier-vscode extension), so I was surprised by Prettier’s command line power.
🌐
DigitalOcean
digitalocean.com › community › tutorials › how-to-format-code-with-prettier-in-visual-studio-code
Format Code with Prettier in Visual Studio Code: Setup Guide | DigitalOcean
August 1, 2025 - Running the “Format Document” command has no effect. Prettier is installed, but files do not reformat when saved. You don’t see any errors or logs in the Output panel. ... Prettier is not set as the default formatter: Visual Studio Code may be using a different formatting extension (such as the built-in formatter for HTML or CSS). Fix: Set Prettier as the default formatter by adding the following to your global or workspace settings.json:
🌐
Stack Overflow
stackoverflow.com › questions › 72556051 › how-to-add-prettier-command-before-code-commit-or-on-save-file-through-devdepend
How to add prettier command before code commit or on save file through devdependencies
July 5, 2022 - 22 What is Prettier keyboard shortcut command in VS Code to format only a block of React code, not just format on file autosave? 0 How to fix JSX/React formatting issue with Prettier in VSCode