title: yarn - Proper way to quickly check if `package.json` and `yarn.lock` requirements are satisfied?
body: <p>I'd like to verify whether all the dependencies in my project (<code>package.json</code> and <code>yarn.lock</code>) are satisfied without having to run <code>yarn install</code> (which builds out a whole dependency tree and makes network requests)</p>
  <p>At first, I was very hopeful that <code>yarn check</code> did this. The following command verifies that each dependency is satisfied in <code>package.json</code> <strong>and</strong> verifies that the installed package matches the <code>yarn.lock</code> file.</p>
  <pre><code>yarn check --integrity --verify-tree
  </code></pre>
  <p>However, <a href="https://classic.yarnpkg.com/en/docs/cli/check" rel="noreferrer">the documentation</a> says this is deprecated as of yarn v2, and that <code>yarn install --check-files</code> should be used instead.</p>
  <p>But <a href="https://classic.yarnpkg.com/en/docs/cli/install#toc-yarn-install-check-files" rel="noreferrer">the documentation for <code>--check-files</code></a> makes it seem like this does something completely different.</p>
  <blockquote>
  <h1>yarn install --check-files</h1>
  <p>Verifies that already installed files in node_modules did not get removed.</p>
  </blockquote>
  <p>I can also verify that running it essentially runs a full <code>yarn install</code> command, so it's not useful here.</p>
  <p>Furthermore, the <a href="https://github.com/yarnpkg/rfcs/pull/106/files#r2304389370" rel="noreferrer">pull request that removed <code>yarn check</code></a> also mentions that the behavior of <code>--check-files</code> isn't exactly intuitive.</p>
  <p><strong>So what's the supported way of running this check in yarn v2 and later?</strong> Is there any way to do a lightweight check against <code>package.json</code> and <code>yarn.lock</code> without having to build out the whole dependency tree over a network like <code>yarn install</code> does?</p>
  <p>FWIW, <a href="https://stackoverflow.com/questions/61894812/check-if-package-json-contains-dependencies-not-in-node-modules">a similar question was asked for <code>npm</code></a> and the solution was to use the <code>--dry-run</code> flag, but that flag doesn't seem to exist in <code>yarn</code>.</p>