language-tools
language-tools copied to clipboard
🐛 BUG: Couldn't load `prettier` or `prettier-plugin-astro` when using Yarn PnP
Describe the Bug
I am using Yarn berry in my project, which I believe is already supported: https://github.com/withastro/language-tools/issues/370 (and I could install the Astro language server nicely).
However, I'm getting this message/error when I'm opening an .astro
file:
Couldn't load
prettier
orprettier-plugin-astro
. Formatting will not work. Please make sure those two packages are installed into your project.
I tried to replicate it in a repository (using Codespaces: https://github.com/imballinst/astro-yarn-berry-pnp), and it seems I am able to replicate the behavior. Do you might have an idea on what I should do, or could you point me out to a documentation that I could use? Thanks! 🙇♂️
Steps to Reproduce
With the sample repository:
-
git clone [email protected]:imballinst/astro-yarn-berry-pnp.git
- Open the folder in VS Code
- Go to
src/layouts/Layout.astro
- See notification popping up on bottom right, and we can't quite prettify Astro files
This is despite that prettier
is already installed as devDependencies
and I have the Prettier SDK already:
"devDependencies": {
"@astrojs/language-server": "2.3.3",
"prettier": "3.0.3"
}
In the extension output, I got this:
["ERROR" - 10:05:32 AM] Failed to resolve a parser, skipping file. If you registered a custom file extension, be sure to configure the parser.