prettier/prettier-vscode

Installed Prettier extension does not format and gives following error: Cannot find module 'prettier'

ldco2016 opened this issue · 4 comments

Installed Prettier extension does not format and gives following error: Cannot find module 'prettier'

That is clearly a bug report of very questionable quality, but I have to say that is real. I often get an error about not having prettier installed.

["INFO" - 14:26:54] Attempted to determine module path from /Users/ssbarnea/c/a/ansible-compat
["ERROR" - 14:26:54] Failed to load module. If you have prettier or plugins referenced in package.json, ensure you have run `npm install`
["ERROR" - 14:26:54] Cannot find module 'prettier' from '/Users/ssbarnea/c/a/ansible-compat'
Error: Cannot find module 'prettier' from '/Users/ssbarnea/c/a/ansible-compat'
	at e.exports [as sync] (/Users/ssbarnea/.vscode/extensions/esbenp.prettier-vscode-1

I use multi-root workspaces, that is for sure and only some of these projects have a package.json in them with prettier, the others do not. Still, I do have prettier installed globally via npm install -g prettier, so I see no reason why the prettier vscode extension would fail to find a prettier.

I do suspect that this might be a newer regression, no more than 1-2 months old as I do not remember seeing it before.

$ which -a prettier
/Users/ssbarnea/.asdf/shims/prettier
/opt/homebrew/bin/prettier

ssbarnea@m1: ~/c/a/molecule chore/contraints
$ prettier --version
3.2.5

This issue has been labeled as stale due to inactivity. Reply to keep this issue open.

I ran into the same problem.

Ran into same issue