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
🌐
npm
npmjs.com › package › prettier-plugin-packagejson
prettier-plugin-packagejson - npm
January 20, 2026 - Prettier package.json plugin to make the order of properties nice.. Latest version: 3.0.1, last published: 4 hours ago. Start using prettier-plugin-packagejson in your project by running `npm i prettier-plugin-packagejson`. There are 402 other projects in the npm registry using prettier-plugin-packagejson.
      » npm install prettier-plugin-packagejson
    
🌐
Prettier
prettier.io › docs › plugins.html
Plugins · Prettier
July 5, 2023 - Strings provided to plugins are ultimately passed to import() expression, so you can provide a module/package name, a path, or anything else import() takes. ... Prettier plugins are regular JavaScript modules with the following five exports or default export with the following properties:
🌐
GitHub
github.com › matzkoh › prettier-plugin-packagejson
GitHub - matzkoh/prettier-plugin-packagejson: Prettier plugin for package.json
A Prettier plugin to sort the keys of a package.json file using sort-package-json.
Starred by 382 users
Forked by 11 users
Languages   JavaScript 90.7% | TypeScript 9.3%
🌐
Prettier
prettier.io › docs › configuration.html
Configuration File · Prettier
July 5, 2023 - A "prettier" key in your package.json, or package.yaml file.
🌐
GitHub
github.com › shellscape › prettier-plugin-package
GitHub - shellscape/prettier-plugin-package: An opinionated package.json formatter plugin for Prettier
Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing, taking various rules into account. This plugin adds support for package.json files used within NPM modules.
Starred by 92 users
Forked by 4 users
Languages   JavaScript
🌐
GitLab
gitlab.com › megabyte labs › node.js and npm packages › plugins › prettier package json prettier plugin
Prettier Package JSON Prettier Plugin - Megabyte Labs
February 1, 2022 - A Prettier plugin that formats the package.json file by leveraging the prettier-package-json CLI library ... automatic fix format + 9 more mblabs megabytelabs package package.json packagejson plugin prettier professorman...
🌐
Yarn
yarnpkg.com › package
prettier-plugin-packagejson
Yarn is a package manager that doubles down as project manager. Whether you work on simple projects or industry monorepos, whether you're an open source developer or an enterprise user, Yarn has your back · First package manager built specifically around workspaces, Yarn lets you split your ...
Find elsewhere
🌐
CodeSandbox
codesandbox.io › examples › package › prettier-plugin-packagejson
prettier-plugin-packagejson examples - CodeSandbox
Use this online prettier-plugin-packagejson playground to view and fork prettier-plugin-packagejson example apps and templates on CodeSandbox.
🌐
jsDelivr
jsdelivr.com › package › npm › prettier-plugin-package
prettier-plugin-package CDN by jsDelivr - A CDN for npm and GitHub
July 31, 2025 - An opinionated package.json formatter plugin for Prettier · Version 2.0.0 License MPL-2.0 · Keywords · packagepackage.jsonpluginprettier · INSTALL · Version: Static · Static · Latest Patch · Latest Minor · Latest Major · Learn more · Readme Files Statistics Browse CDN ·
Published   Sep 05, 2019
🌐
Runkit
runkit.com › npm › prettier-plugin-packagejson
RunKit
require("prettier/package.json"); // prettier is a peer dependency. var prettierPluginPackagejson = require("prettier-plugin-packagejson")
🌐
Prettier
prettier.io › docs › install.html
Install · Prettier
July 5, 2023 - If you forget to install Prettier first, npx will temporarily download the latest version. That’s not a good idea when using Prettier, because we change how code is formatted in each release! It’s important to have a locked down version of Prettier in your package.json.
🌐
Prettier
prettier.io
Prettier · Opinionated Code Formatter · Prettier
Community Plugins · Apex · Elm (via elm-format) Java · PHP · Ruby · Rust · TOML · XML · And more... prettier-js prettier.el Apheleia · espresso-prettier · Prettier Prettier⁺ · JsPrettier · vim-prettier neoformat ALE coc-prettier · JavaScriptPrettier ·
🌐
Prettier
prettier.io › docs › cli.html
CLI · Prettier
July 5, 2023 - Also, since the cache file is stored in ./node_modules/.cache/prettier/.prettier-cache, so you can use rm ./node_modules/.cache/prettier/.prettier-cache to remove it manually. ... Plugins version and implementation are not used as cache keys.
🌐
GitHub
github.com › prettier › prettier-vscode › issues › 950
Prettier plugin being ignored if installed via another package. · Issue #950 · prettier/prettier-vscode
July 11, 2019 - Make/create a NPM package with for example the PHP plugin as dependency. Include the newly created npm package in your project. Open a PHP file, run prettier on it.
Published   Sep 09, 2019
🌐
npm
npmjs.com › package › prettier-plugin-package
prettier-plugin-package - npm
July 31, 2025 - An opinionated package.json formatter plugin for Prettier. Latest version: 2.0.0, last published: 7 months ago. Start using prettier-plugin-package in your project by running `npm i prettier-plugin-package`. There are 18 other projects in the npm registry using prettier-plugin-package.
      » npm install prettier-plugin-package
    
Published   Jul 31, 2025
Version   2.0.0
Author   shellscape
🌐
npm
npmjs.com › package › @prettier › plugin-php
@prettier/plugin-php - npm
July 16, 2025 - Bundlers like webpack, Rollup or browserify automatically recognize how to handle the PHP plugin. Remember that even when using a bundler, you still have to use the standalone builds: import prettier from "prettier/standalone"; import * as prettierPluginPhp from "@prettier/plugin-php/standalone"; await prettier.format(YOUR_CODE, { plugins: [prettierPluginPhp], parser: "php", });
      » npm install @prettier/plugin-php
    
Published   Jul 16, 2025
Version   0.24.0
Author   Lucas Azzola
🌐
npm
npmjs.com › package › eslint-plugin-prettier
eslint-plugin-prettier - npm
January 14, 2026 - Runs prettier as an eslint rule. Latest version: 5.5.5, last published: 2 months ago. Start using eslint-plugin-prettier in your project by running `npm i eslint-plugin-prettier`. There are 8708 other projects in the npm registry using eslint-plugin-prettier.
      » npm install eslint-plugin-prettier
    
Published   Jan 14, 2026
Version   5.5.5
Author   Teddy Katz