title: yarn zero install - missing packages from unplugged directory but can't commit local unplugged directory
body: <p>Switching to the yarn zero installs approach (see <a href="https://yarnpkg.com/features/zero-installs" rel="nofollow noreferrer">https://yarnpkg.com/features/zero-installs</a>) I encountered errors in the following style when running our CI pipeline:</p>
  <pre><code>/app/.pnp.cjs:47262
  throw firstError;
        ^
   
  Error: Required unplugged package missing from disk. This may happen when switching branches without running installs (unplugged packages must be fully materialized on disk to work).
   
  Missing package: nodemon@npm:2.0.7
  Expected package location: /app/.yarn/unplugged/nodemon-npm-2.0.7-7b95e46511/node_modules/nodemon/
  .
  .
  .
  </code></pre>
  <p>Ok, that was expected, since this approach doesn't run <code>yarn install</code> and just uses the files from the cache in <code>.yarn</code>. Following the advice in the last point of this paragraph <a href="https://yarnpkg.com/features/zero-installs#how-do-you-reach-this-zero-install-state-youre-advocating-for" rel="nofollow noreferrer">https://yarnpkg.com/features/zero-installs#how-do-you-reach-this-zero-install-state-youre-advocating-for</a> I adjusted my <code>.gitignore</code> and <code>.dockerignore</code> files to include this:</p>
  <pre><code>.yarn/*
  !.yarn/cache
  !.yarn/patches
  !.yarn/plugins
  !.yarn/releases
  !.yarn/sdks
  !.yarn/versions
  !.yarn/unplugged
  </code></pre>
  <p>The unplugged folder should therefore be able to be committed to the repo and with that, available during the CI pipeline. But as you can see, the files of each package in the unplugged folder remain greyed out and cannot be committed.</p>
  <p>The output of <code>git status --ignore</code> still lists the <code>unplugged</code> dir, even after checking all <code>.gitignore</code> files:</p>
  <pre><code>.yarn/.DS_Store
  .yarn/build-state.yml
  .yarn/cache/.gitignore
  .yarn/install-state.gz
  .yarn/unplugged/
  </code></pre>
  <p>What can I do to get the files into the repo or otherwise avoid the error mentioned in the beginning?</p>
  <p><a href="https://i.stack.imgur.com/4vdYh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4vdYh.png" alt="yarn folder" /></a></p>