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
🌐
npm
npmjs.com › package › prettier
prettier - npm
January 21, 2026 - Prettier is an opinionated code formatter. Latest version: 3.8.1, last published: 2 months ago. Start using prettier in your project by running `npm i prettier`. There are 20182 other projects in the npm registry using prettier.
      » npm install prettier
    
Published   Jan 21, 2026
Version   3.8.1
Author   James Long
Discussions

node.js - prettier command not working even though prettier is in devDependancies - Stack Overflow
Copy$ npx prettier -v /var/folders/q6/npwl_7xj4wg91lg06f8pnnfh0000gn/T/npx-b98a4fce.sh: line 1: prettier: command not found · Not sure if this- /var/folders/q6/npwl_7xj4wg91lg06f8pnnfh0000gn/T/npx-b98a4fce.sh- is normal. I am using nvm, using node v16.17.1 and npm v8.15.0 More on stackoverflow.com
🌐 stackoverflow.com
How do I use the CLI to fix all files?
I apologize if this is a stupid question. We have a large monorepo containing lots of projects. We need to specify the exact set of paths to be processed by Prettier. It's not okay for Prettier to ... More on github.com
🌐 github.com
19
May 7, 2025
Prettier CLI does not work with npm v7 (ERROR: prettier not found)
Environments: Prettier Version: 2.1.2 Running Prettier via: CLI Runtime: Node.js v15: v15.0.1 NPM v7: 7.0.3 Operating System: macOS Steps to reproduce: We have added following in the Scripts sectio... More on github.com
🌐 github.com
11
November 5, 2020
help with create-react-app and eslint/prettier
Maybe it is a dumb question, but do you have installed the Prettier Extension for VSCode and have enabled the "Format on Save" feature? More on reddit.com
🌐 r/react
16
0
December 5, 2022
🌐
Prettier
prettier.io › docs › install
Install · Prettier
For example, you can do the following to have Prettier run before each commit: ... npm install --save-dev husky lint-staged npx husky init node --eval "fs.writeFileSync('.husky/pre-commit','npx lint-staged\n')"
🌐
npm
npmjs.com › package › eslint-plugin-prettier
eslint-plugin-prettier - npm
January 14, 2026 - If you’re fixing large of amounts of previously unformatted code, consider temporarily disabling the prettier/prettier rule and running eslint --fix and prettier --write separately.
      » npm install eslint-plugin-prettier
    
Published   Jan 14, 2026
Version   5.5.5
Author   Teddy Katz
🌐
Prettier
prettier.io › docs › cli
CLI · Prettier
Checking formatting... [warn] src/fileA.js [warn] src/fileB.js [warn] Code style issues found in 2 files. Run Prettier with --write to fix.
🌐
npm
npmjs.com › package › prettier-eslint
prettier-eslint - npm
January 21, 2022 - Formats your JavaScript using prettier followed by eslint --fix. Latest version: 16.4.2, last published: 10 months ago. Start using prettier-eslint in your project by running `npm i prettier-eslint`. There are 340 other projects in the npm registry ...
      » npm install prettier-eslint
    
Published   May 07, 2025
Version   16.4.2
Author   Kent C. Dodds
🌐
GitHub
btholt.github.io › complete-intro-to-react-v5 › eslint-prettier
npm, ESLint & Prettier
Either install Prettier globally npm install --global prettier or replace when I run prettier with (from the root of your project) npx prettier. From there, run prettier script.js. This will output the formatted version of your file. If you want to actually write the file, run prettier --write ...
🌐
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.
Find elsewhere
🌐
npm
npmjs.com › package › prettier-eslint-cli
prettier-eslint-cli - npm
October 14, 2023 - This is a CLI that allows you to use prettier-eslint on one or multiple files. prettier-eslint-cli forwards on the filePath and other relevant options to prettier-eslint which identifies the applicable ESLint config for each file and uses that ...
      » npm install prettier-eslint-cli
    
Published   Oct 14, 2023
Version   8.0.1
Author   Kent C. Dodds
🌐
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. This way you can get the benefits of prettier's superior formatting capabilities, but also benefit from the configuration capabilities of eslint.
Starred by 4.1K users
Forked by 175 users
Languages   TypeScript 92.9% | JavaScript 7.1%
🌐
LocalUsr
localusr.com › posts › 2022 › 01 › 3-how-to-fix-prettier-code-style-issues
How to Fix Prettier Code Style Issues :: LocalUsr
July 9, 2019 - This fix assumes that you have prettier or prettier-eslint set up in your project. You have used prettier in the project before and it was working as expected. You have prettier locally installed in your project or globally using yarn add -g prettier or npm i -g prettier.
🌐
GitHub
github.com › prettier › prettier › issues › 6280
How do I use the CLI to fix all files? · Issue #6280 · prettier/prettier
May 7, 2025 - The .prettierignore config file seems like the right way to do this. Well, actually we want to specify what DOES get processed, rather than what doesn't.
Author   octogonz
🌐
GitHub
gist.github.com › Mohamed3on › 840b34ecb7e9abf06ace035183b7f1fc
Run prettier on all JS files in a directory · GitHub
Make a .prettierignore file, and add directories you'd like prettier to not format, for example: **/node_modules
🌐
GitHub
github.com › prettier › prettier › issues › 9611
Prettier CLI does not work with npm v7 (ERROR: prettier not found) · Issue #9611 · prettier/prettier
November 5, 2020 - Running Prettier via: CLI · Runtime: Node.js v15: v15.0.1 NPM v7: 7.0.3 · Operating System: macOS · Steps to reproduce: We have added following in the Scripts section of package.json: "fix:prettier": "prettier --write --config ./.prettierrc './**/*.{ts,tsx}' " npm run fix:prettier ·
Author   Poorva17
🌐
GitHub
github.com › prettier › eslint-config-prettier
GitHub - prettier/eslint-config-prettier: Turns off all rules that are unnecessary or might conflict with Prettier. · GitHub
October 14, 2023 - Some can cause problems if using eslint-plugin-prettier and --fix.
Starred by 5.9K users
Forked by 262 users
Languages   JavaScript
🌐
Reddit
reddit.com › r/react › help with create-react-app and eslint/prettier
r/react on Reddit: help with create-react-app and eslint/prettier
December 5, 2022 -

so ive been messing around with create-react-app, ive probably set it up dozens of times now to try to debug why prettier wont work. I also get a bunch of vulnerabilities in the console once i do install prettier (but it still wont work). here is my process.

npx create-react-app test
npm install --save-dev --save-exact prettier

1. added 1 package, and audited 1497 packages in 2s
236 packages are looking for funding
  run `npm fund` for details

74 vulnerabilities (69 moderate, 5 high)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

ignore the warnings and make a new .prettierrc.json in the root directory of the project. I paste the following into the prettier config:

{
"semi": true, "singleQuote": true, "tabWidth": 2, "trailingComma": "es5", "printWidth": 80 }

I add .eslintrc.json to the root directory as well, and then i add this to it:

{ "extends": ["react-app", "react-app/jest", "plugin:prettier/recommended"], "rules": { 
"prettier/prettier": ["error"] } }  

i press ctrl + , to make sure format on save is checked in the settings of vscode. i also make sure that the prettier extension is installed from the vs code store

I open and close back vscode, make a bad formatting on purpose like :

let x_______________ = 5. (the ____ are spaces with spacebar)

and i expect that when i press ctrl + s, it will remove the spaces, or even add the semicolon at the end, but it doesnt. prettier doesnt work at all. here is my repo: https://github.com/ForkEyeee/test

i guess my questions are: why do i get all of those vulnerabilties? is this normal cause all i do is start a new cra, then install prettier and i get so many errors. also, cra supports eslint out of the box, but not prettier, so is my install process of prettier correct. i even tried vite briefly and i had the same issue as webpack.

🌐
npm
npmjs.com › package › eslint-config-prettier
eslint-config-prettier - npm
July 18, 2025 - Turns off all rules that are unnecessary or might conflict with Prettier.. Latest version: 10.1.8, last published: 8 months ago. Start using eslint-config-prettier in your project by running `npm i eslint-config-prettier`. There are 12201 other projects in the npm registry using eslint-con...
      » npm install eslint-config-prettier
    
Published   Jul 18, 2025
Version   10.1.8
Author   Simon Lydell
🌐
Khalil Stemmler
khalilstemmler.com › blogs › tooling › prettier
How to use Prettier with ESLint and TypeScript in VSCode | Khalil Stemmler
October 22, 2024 - --ext .ts simple-typescript-starter/src/index.ts 1:1 error Replace `⏎console.log('Hello·world!')⏎` with `console.log('Hello·world!');` prettier/prettier 2:1 warning Unexpected console statement no-console ✖ 2 problems (1 error, 1 warning) 1 error and 0 warnings potentially fixable with the `--fix` option. That's it! Run npm run prettier-format to format everything.