Since upgrading to Yarn 2+ (Berry), and later Yarn 4 with PnP support, VSCode cannot resolve locations for extensions prettier, eslint and others. In VSCode I receive the following error message:
Error: Cannot find module 'prettier'
I've ensured prettier is installed correctly, updated every prettier config possible, and nothing seems to work.
yarn dlx @yarnpkg/sdks vscode
VSCode couldn't resolve prettier inside of node_modules
since that folder doesn't exist when PnP is enabled. The fix was super easy, as described in Yarn's documentation on Editor SDKs.
"Smart IDEs (such as VSCode or IntelliJ) require special configuration for TypeScript to work when using Plug'n'Play installs."
This script installed and configured a bunch of files in my .yarn
directory, and immediately solved my issues. Check out the links above to read more.