It helped for me let's try:

npm install -g prettier
Answer from Dheeraj Maheshwari on Stack Overflow
🌐
GitHub
github.com › prettier › prettier-vscode › issues › 1156
Prettier Extension Not working in VS Code · Issue #1156 · prettier/prettier-vscode
December 20, 2019 - Running the contributed command: 'prettier.openOutput' failed. I am getting this error on VS code.
Published   Dec 20, 2019
🌐
GitHub
github.com › prettier › prettier › issues › 2869
Prettier: command not found · Issue #2869 · prettier/prettier
September 20, 2017 - [3/4] Linking dependencies... [4/4] Building fresh packages... success Installed "prettier@1.7.0" with binaries: - prettier Done in 2.48s. Charlie@LAPTOP-I1MN5SLU MINGW64 ~/complete-intro-to-react/node_modules (start) $ prettier -v bash: prettier: command not found
Published   Sep 20, 2017
🌐
GitHub
github.com › prettier › prettier › issues › 4569
Command not found · Issue #4569 · prettier/prettier
May 27, 2018 - prettier -v · But I get command not found error: zsh: command not found: prettier · Reactions are currently unavailable · No one assigned ·
Published   May 27, 2018
Find elsewhere
🌐
Reddit
reddit.com › r/vscode › prettier not working from the command palette
r/vscode on Reddit: Prettier not working from the Command Palette
March 20, 2023 -

Hi there,

I'm using VS Code on Windows 11, and I have installed Prettier. However, I can only use it from the terminal.

If I execute npx Prettier --write dom.html in the terminal, it works fine.

If I go to the Command Palette and choose Format Document, the following error appears in the output:

["ERROR" - 10:38:49 AM] Invalid prettier configuration file detected.
["ERROR" - 10:38:49 AM] ENOENT: no such file or directory, open 'c:\Users\ivanf\Dropbox\dev\FrontEndBootCamp - Exercises\firstjs\ C:\Users\ivanf\AppData\Roaming\npm\prettier'
Error: ENOENT: no such file or directory, open 'c:\Users\ivanf\Dropbox\dev\FrontEndBootCamp - Exercises\firstjs\ C:\Users\ivanf\AppData\Roaming\npm\prettier'

To make it more clear,

c:\Users\ivanf\Dropbox\dev\FrontEndBootCamp - Exercises\firstjs\ is the project folder, and \Users\ivanf\AppData\Roaming\npm\prettier is where prettier is installed.

So it seems that in some configuration file the wrong path "PROJECT_FOLDER PRETTIER_HOME" is formed.

Unfortunately, I cannot locate such file, and I cannot understand why it works when called from the terminal.

Any advice or hints? Thank you in advance, Ivan.

🌐
Reddit
reddit.com › r/vscode › prettier stopped working suddenly and command "format document with" not found in command palette
r/vscode on Reddit: Prettier stopped working suddenly and Command "Format Document with" not found in Command Palette
May 15, 2021 - Prettier just suddenly stopped working and complained "Extension 'Prettier - Code Formatter' cannot format xxxx". A lot of the solutions online point to configuring default code formatter via the "Format Document with" in Command Palette instead of "Preference > Setting" but there is not any "Format Document with" command at all, just "Format Document".
🌐
Stack Exchange
unix.stackexchange.com › questions › 732863 › output-of-command-not-being-stored-and-failing-regex
bash - Output of Command not being stored and failing Regex - Unix & Linux Stack Exchange
If I change to VAR=$(yarn prettier --check ./src 2>&1) it will still run the command and check, but will still say line 4: [[1: command not found Passeed Prettier
🌐
GitHub
github.com › creyD › prettier_action › issues › 114
[BUG] prettier: command not found · Issue #114 · creyD/prettier_action
November 18, 2022 - Installing prettier... Prettifying files... /home/runner/work/_actions/creyD/prettier_action/v4.2/entrypoint.sh: line 74: prettier: command not found Files: Problem running prettier with --check **/*.{md,yml} Error: Process completed with exit code 1.
Published   Feb 18, 2023
🌐
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. npx prettier --help, yarn exec prettier --help, pnpm exec prettier --help, or bunx prettier --help.
🌐
Stack Exchange
salesforce.stackexchange.com › questions › 379000 › prettier-not-working-in-vs-code
salesforcedx - Prettier not working in VS code - Salesforce Stack Exchange
Added the path '\AppData\Roaming\npm\node_modules\prettier' to the prettier path as is mentioned in the following solution in "https://stackoverflow.com/questions/58866847/in-vs-code-im-getting-this-error-failed-to-load-module-attempted-to-load-pr".
🌐
DEV Community
dev.to › dmytrych › fixing-prettier-not-working-with-vscode-44ml
Fixing Prettier not working with VSCode - DEV Community
June 9, 2023 - Ukrainian version Problem Description You have installed and enabled Prettier in your JS... Tagged with vscode, javascript, beginners, programming.
🌐
Fishtank
getfishtank.com › insights › running-prettier-from-the-command-line
Running Prettier from the Command Line | Fishtank
Next is to create a .prettierignore file in your project root directory and specify which file to not format.
🌐
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.
🌐
Prettier
prettier.io › docs › install
Install · Prettier
If your editor does not support Prettier, you can instead run Prettier with a file watcher. ... Don’t skip the regular local install! Editor plugins will pick up your local version of Prettier, making sure you use the correct version in every project. (You wouldn’t want your editor accidentally causing lots of changes because it’s using a newer version of Prettier than your project!) And being able to run Prettier from the command line is still a good fallback, and needed for CI setups.
🌐
GitHub
github.com › prettier › prettier-vscode › issues › 2181
Prettier suddenly not loading anymore · Issue #2181 · prettier/prettier-vscode
July 29, 2021 - Command 'Format Document (Forced)' resulted in an error (command 'prettier.forceFormatDocument' not found)
Published   Sep 14, 2021