title: npm equivalent of yarn install --check-files (or yarn check)
body: <p><strong>Update for 2020</strong></p>
  <p>This question originally referred to the <code>yarn check</code> command, but <a href="https://classic.yarnpkg.com/en/docs/cli/check/#toc-yarn-check" rel="noreferrer">the docs</a> state that this is deprecated in v1, and removed in v2, and <code>yarn install --check-files</code> should be used instead.</p>
  <p>Unfortunately there is <em>still</em>, apparently, no equivalent of the <code>--check-files</code> flag in <code>npm install</code>!</p>
  <hr />
  <p>As part of my development build I'd like to check that the versions of dependencies in <code>node_modules</code> are what's expected to be there according to both what's specified in <code>package.json</code> and the lockfile <code>package-lock.json</code>.</p>
  <p>In yarn you can do this with <code>yarn install --check-files</code> (or the older <a href="https://classic.yarnpkg.com/en/docs/cli/check/#toc-yarn-check" rel="noreferrer">deprecated</a> <code>yarn check</code> command in v1)</p>
  <p><strong>I am trying to achieve the same using npm.</strong></p>
  <p>At the moment I am using <code>npm ci</code> (<a href="https://docs.npmjs.com/cli/ci" rel="noreferrer">see docs here</a>) which does work, in the sense that it completely reinstalls <code>node_modules</code> from what's in the lockfile and then errors if the versions in <code>package.json</code> don't match.</p>
  <p>But, this is a bit heavyweight and slow. I'm wondering if there is a purely static way to run these checks with npm that doesn't involve cleaning and reinstalling everything on disk?</p>