I ran into this error while using a .prettierrc.json file, and the problem was that the file was encoded in UTF-16LE, not UTF-8. Saving the file as UTF-8 fixed this for me.

The root cause of this issue was following the documentation that recommended echo {}> .prettierrc.json to create the file. On Windows powershell, this creates a UTF-16LE file, not a UTF-8 file.

More discussion can be found at this github issue

Answer from Luke Miller on Stack Overflow
🌐
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 › 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 20158 other projects in the npm registry using prettier.
      » npm install prettier
    
Published   Jan 21, 2026
Version   3.8.1
Author   James Long
Discussions

How to run prettier check ?
Do i need to host the site with docker in order to run prettier? Thanks in advance. Beta Was this translation helpful? Give feedback. ... "Then, you can install it using npm install prettier inside the project directory, or install it globally on your computer using npm install -g prettier. More on github.com
🌐 github.com
1
1
command line interface - Run prettier from CLI with config in package.json - Stack Overflow
I'm trying to run Prettier from CLI defining the config in the package.json file as it's explained in Offical Docs Prettier uses cosmiconfig for configuration file support. This means you can More on stackoverflow.com
🌐 stackoverflow.com
node.js - Prettier on-save different to running via npm - Stack Overflow
Basically, when I run prettier via VS Code and via npm I get different results. Running via npm doesn't re-order the imports. More on stackoverflow.com
🌐 stackoverflow.com
How do you handle eslint/prettier configs across multiple repos?
I manage and use a monorepo for my ESLint configs via NPM - each package is a single config (for Vue, React, TypeScript) that extends a set of base settings that I use throughout all of my JS/TS code. I use This configuration has worked well for me on both personal and enterprise-scale projects and I've been able to enjoy consistent code style with minimal boilerplate and config. Whenever I need to override a rule for some project-specific need, I simply extend the config in the consuming project. For Prettier, I likewise pull in a shared config that I publish on NPM. Both ESLint and Prettier have first-class support for packaged, shared configs i.e. this is the recommended way to consume such configs across many projects. Prettier is very opinionated and far less configurable than ESLint by design. Don't confuse these tools, however. ESLint is a linter; Prettier is a formatter. The goal of Prettier is to offload the cognitive overhead involved with deciding on a formatting style. Because there's potential overlap between the two tools; use `eslint-config-prettier` when using the two together to prevent collisions between them. To answer your next question: I lint and format on save, and I use Git hooks installed by Husky and executed through Lint-Staged (this tool helps ensure your Git hooks only run on modified files, etc) to ensure there are no lint or formatting errors whenever making a commit or pushing code. This is helpful for teams, as some developers tend to forget to run lint tasks, or don't have the Prettier extension installed in their IDE. If there are lint errors, the commit is rejected until fixed. YMMV - you'll need to fine-tune the strictness of this based on the team's needs. To answer your "random question": preference for ubiquitous backticks is rare and non-idiomatic in JS/TS. Use backticks for multi-line strings or template literals (string interpolation - and in less common cases - tagged template functions ). For all other use-cases, use single or double-quote (it doesn't matter which, just be consistent about the choice you make). More on reddit.com
🌐 r/typescript
26
30
April 14, 2023
🌐
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.
🌐
Prettier
prettier.io › docs › cli
CLI · Prettier
To run your locally installed version of Prettier, prefix the command with npx, yarn exec, pnpm exec, or bunx, i.e.
🌐
GitHub
github.com › alshedivat › al-folio › discussions › 2623
How to run prettier check ? · alshedivat/al-folio · Discussion #2623
"Then, you can install it using npm install prettier inside the project directory, or install it globally on your computer using npm install -g prettier. To run prettier on your current directory use npx prettier . --write." Works for me.
Author   alshedivat
🌐
LogRocket
blog.logrocket.com › home › using prettier and eslint for javascript formatting
Using Prettier and ESLint for JavaScript formatting - LogRocket Blog
October 22, 2024 - 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.
🌐
JetBrains
jetbrains.com › help › webstorm › prettier.html
Prettier | WebStorm Documentation
For more information about plugins, refer to Managing plugins. Open the embedded Terminal (Alt+F12) . Type one of the following commands: npm install --save-dev --save-exact prettier ·
Find elsewhere
🌐
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 ...
🌐
DEV Community
dev.to › bokub › how-to-properly-set-up-prettier-in-less-than-2-minutes-2ld0
How to properly set up Prettier in less than 2 minutes - DEV Community
July 5, 2022 - The setup can be a little bit long if you actually read the whole documentation, but here are the commands you need to run to set everything up: # With npm npx husky-init npm i -D pretty-quick npx husky set .husky/pre-commit "npx pretty-quick --staged" # With yarn npx husky-init yarn add -D pretty-quick yarn husky set .husky/pre-commit "npx pretty-quick --staged" That’s it ! You will now see this kind of message every time you commit something: The main differences between Prettier and ESLint are the following:
🌐
JetBrains
jetbrains.com › help › phpstorm › prettier.html
Prettier | PhpStorm Documentation
November 24, 2025 - Make sure the JavaScript and TypeScript ... the embedded Terminal (Alt+F12) . Type one of the following commands: npm install --save-dev --save-exact prettier ·...
🌐
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 - npm install --save-dev prettier eslint-config-prettier eslint-plugin-prettier · eslint-config-prettier: Turns off formatting rules that would conflict with Prettier · eslint-plugin-prettier: Runs Prettier as an ESLint rule and reports formatting issues as lint errors
🌐
Stack Overflow
stackoverflow.com › questions › 76065978 › prettier-on-save-different-to-running-via-npm
node.js - Prettier on-save different to running via npm - Stack Overflow
Basically, when I run prettier via VS Code and via npm I get different results. Running via npm doesn't re-order the imports.
🌐
JetBrains
jetbrains.com › help › idea › prettier.html
Prettier | IntelliJ IDEA Documentation
Make sure the JavaScript and TypeScript ... the embedded Terminal (Alt+F12) . Type one of the following commands: npm install --save-dev --save-exact prettier ·...
🌐
npm
npmjs.com › package › prettier-format
prettier-format - npm
September 8, 2023 - auto load config and run prettier on code. Latest version: 4.0.0, last published: 2 years ago. Start using prettier-format in your project by running `npm i prettier-format`. There are 4 other projects in the npm registry using prettier-format.
      » npm install prettier-format
    
Published   Sep 08, 2023
Version   4.0.0
Author   fisker Cheung
🌐
Bitstack
blog.bitsrc.io › add-prettier-to-your-project-d7e91ac03d05
How to Add Prettier to a Project. Format code in your project with… | by Ivo Nederlof | Bits and Pieces
March 4, 2025 - yarn add -D prettier // or npm install --save-dev prettier · { "singleQuote": true, "bracketSpacing": true, "printWidth": 120 } Note: You can edit these settings to your preference.
🌐
Prettier
prettier.io › docs › browser
Browser · Prettier
Run Prettier in the browser using its standalone version. This version doesn’t depend on Node.js. It only formats the code and has no support for config files, ignore files, CLI usage, or automatic loading of plugins.
🌐
Prettier
prettier.io › docs › configuration
Configuration File · Prettier
Otherwise, Prettier wouldn’t be able to guarantee that everybody in a team gets the same consistent results. The options you can use in the configuration file are the same as the API options. TypeScript support requires Node.js>=22.6.0, and --experimental-strip-types is required before Node.js v24.3.0 to run Node.js.
🌐
Prettier
prettier.io
Prettier · Opinionated Code Formatter · Prettier
More than 19.4k dependent packages on npmSee them all