TransWikia.com

How to configure VSCode to find yarn v2 installed modules

Super User Asked by Michael Prescott on January 1, 2022

I’ve a project setup with yarnv2 and I work within VSCode. TypeScript’s tsc can resolve dependencies; however, VSCode cannot.

enter image description here

I’ve tried yarn dlx @yarnpkg/pnpify --sdk vscode and yarn unplug uuid, but neither has had any effect. I believe the problem is that VSCode expects @types/uuid (and other modules) to be expanded and in a ./node_modules directory at the base of the project; however, I would have also guessed that pnpify or unplug would have assisted. So, I’m just speculating. Is it possible to have VSCode work with Yarn V2 projects or is it not ready, yet?

I also found this, https://stackoverflow.com/questions/60778047/yarn-cannot-find-module, but still no luck.

One Answer

I found this https://stackoverflow.com/questions/54954337/is-it-possible-to-use-yarn-pnp-with-typescript-vscode

The critical step that finally got VSCode configured was setting the workspace version to 3.9.7-pnpify. See bottom right of VSCode: enter image description here

However, along the way in trying to solve it, I ran the two commands noted above, and yarn add @yarnpkg/pnpify followed by yarn pnpify --sdk without specifying vscode. Point being, I'm not sure if @yarnpkg/pnpify MUST be in the workspace or not. So if it fails for you, maybe try all of the above.

Answered by Michael Prescott on January 1, 2022

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP