title: How to configure VSCode to run Yarn 2 (with PnP) powered TypeScript
body: <p>How to configure VSCode to run Yarn 2 (with PnP) powered TypeScript</p>
  <p>I like to use Yarn 2 (with PnP) and a few months ago I setup a project for which it worked fine. Now I tried to setup a fresh project, but whatever I try, I cannot get VSCode to resolve the modules properly. The old project still works and my test case works properly in it, so it must be the new project and not VSCode wherein the problem lies.</p>
  <p>My new project is setup as follows:</p>
  <pre><code>mkdir my-project
  cd my-project
  npm install -g npm
  npm install -g yarn
  yarn set version berry
  yarn init
  yarn add --dev @types/node typescript ts-node prettier
  yarn dlx @yarnpkg/pnpify --sdk vscode
  cat &lt;&lt;'EOF' &gt; tsconfig.json
  {
    &quot;compilerOptions&quot;: {
      &quot;types&quot;: [
        &quot;node&quot;
      ]
    }
  }
  EOF
  mkdir src
  cat &lt;&lt;'EOF' &gt; src/test.ts
  process.once(&quot;SIGINT&quot;, () =&gt; process.exit(0));
  EOF
  </code></pre>
  <p>I did check similar questions on StackExchange and elsewhere, but they come down to running <code>pnpify</code> and selecting the TypeScript version within VSCode to be its workbench <code>-pnpify</code> version, which I both did. I also made sure to preform a <code>Reload Window</code>, but I still get the following errors:</p>
  <p>In <code>tsconfig.json</code>: Cannot find type definition file for 'node'.</p>
  <p>And in <code>test.ts</code>: Cannot find name 'process'. Do you need to install type definitions for node? Try <code>npm i --save-dev @types/node</code> and then add <code>node</code> to the types field in your tsconfig.</p>
  <p>It is important to note that I can run <code>test.ts</code> without any problems like so: <code>yarn ts-node src/test.ts</code>. Thus the problem seems limited to the workbench configuration of VSCode (VSCode can still resolve modules for my old project).</p>
  <p><strong>What steps am I missing in my setup to make Yarn 2 (with PnP) powered TypeScript properly work within VSCode?</strong></p>
  <p>VSCode about information:</p>
  <pre><code>Version: 1.51.1
  Commit: e5a624b788d92b8d34d1392e4c4d9789406efe8f
  Date: 2020-11-10T23:31:29.624Z
  Electron: 9.3.3
  Chrome: 83.0.4103.122
  Node.js: 12.14.1
  V8: 8.3.110.13-electron.0
  OS: Linux x64 5.7.19
  </code></pre>
  <p>Reported TypeScript version in VSCode: <code>4.1.3-pnpify</code>.</p>
  <pre><code>&gt; cd my-project
  &gt; yarn --version
  2.4.0
  </code></pre>
  <p>Update: I tried adding <code>nodeLinker: node-modules</code> to <code>.yarnrc.yml</code> and when I <code>Reload Window</code> VSCode no longer reports errors and it correctly returns <code>NodeJS.Process</code> when I hover <code>process</code> in my <code>test.ts</code>. This at least shows that most of the setup should be correct, and its only PnP that is making trouble for VSCode.</p>