<h3 dir="auto">Is there an existing issue for this?</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the existing issues</li>
</ul>
<h3 dir="auto">Current Behavior</h3>
<p dir="auto"><strong>peer-test/package.json</strong></p>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
  &quot;name&quot;: &quot;peer-test&quot;,
  &quot;version&quot;: &quot;1.0.0&quot;,
  &quot;description&quot;: &quot;&quot;,
  &quot;main&quot;: &quot;index.js&quot;,
  &quot;scripts&quot;: {
    &quot;test&quot;: &quot;echo \&quot;Error: no test specified\&quot; &amp;&amp; exit 1&quot;
  },
  &quot;dependencies&quot;: {
    &quot;peertest-a&quot;: &quot;^1.0.0&quot;,
    &quot;peertest-b&quot;: &quot;^1.0.0&quot;
  },
  &quot;keywords&quot;: [],
  &quot;author&quot;: &quot;&quot;,
  &quot;license&quot;: &quot;ISC&quot;
}"><pre class="notranslate">{
  <span class="pl-ent">"name"</span>: <span class="pl-s"><span class="pl-pds">"</span>peer-test<span class="pl-pds">"</span></span>,
  <span class="pl-ent">"version"</span>: <span class="pl-s"><span class="pl-pds">"</span>1.0.0<span class="pl-pds">"</span></span>,
  <span class="pl-ent">"description"</span>: <span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span>,
  <span class="pl-ent">"main"</span>: <span class="pl-s"><span class="pl-pds">"</span>index.js<span class="pl-pds">"</span></span>,
  <span class="pl-ent">"scripts"</span>: {
    <span class="pl-ent">"test"</span>: <span class="pl-s"><span class="pl-pds">"</span>echo <span class="pl-cce">\"</span>Error: no test specified<span class="pl-cce">\"</span> &amp;&amp; exit 1<span class="pl-pds">"</span></span>
  },
  <span class="pl-ent">"dependencies"</span>: {
    <span class="pl-ent">"peertest-a"</span>: <span class="pl-s"><span class="pl-pds">"</span>^1.0.0<span class="pl-pds">"</span></span>,
    <span class="pl-ent">"peertest-b"</span>: <span class="pl-s"><span class="pl-pds">"</span>^1.0.0<span class="pl-pds">"</span></span>
  },
  <span class="pl-ent">"keywords"</span>: [],
  <span class="pl-ent">"author"</span>: <span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span>,
  <span class="pl-ent">"license"</span>: <span class="pl-s"><span class="pl-pds">"</span>ISC<span class="pl-pds">"</span></span>
}</pre></div>
<p dir="auto"><strong>peertest-a have 1.0.0 and 2.0.0(latest) all of them have dependencies and peerDependencies are empty</strong><br>
<strong>peertest-b/package.json 1.0.0(latest)</strong></p>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
  &quot;name&quot;: &quot;peertest-b&quot;,
  &quot;version&quot;: &quot;1.0.0&quot;,
  &quot;description&quot;: &quot;&quot;,
  &quot;main&quot;: &quot;index.js&quot;,
  &quot;scripts&quot;: {
    &quot;test&quot;: &quot;echo \&quot;Error: no test specified\&quot; &amp;&amp; exit 1&quot;
  },
  &quot;dependencies&quot;: {
    &quot;peertest-c&quot;: &quot;^1.0.0&quot;
  },
  &quot;keywords&quot;: [],
  &quot;author&quot;: &quot;&quot;,
  &quot;license&quot;: &quot;ISC&quot;
}"><pre class="notranslate">{
  <span class="pl-ent">"name"</span>: <span class="pl-s"><span class="pl-pds">"</span>peertest-b<span class="pl-pds">"</span></span>,
  <span class="pl-ent">"version"</span>: <span class="pl-s"><span class="pl-pds">"</span>1.0.0<span class="pl-pds">"</span></span>,
  <span class="pl-ent">"description"</span>: <span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span>,
  <span class="pl-ent">"main"</span>: <span class="pl-s"><span class="pl-pds">"</span>index.js<span class="pl-pds">"</span></span>,
  <span class="pl-ent">"scripts"</span>: {
    <span class="pl-ent">"test"</span>: <span class="pl-s"><span class="pl-pds">"</span>echo <span class="pl-cce">\"</span>Error: no test specified<span class="pl-cce">\"</span> &amp;&amp; exit 1<span class="pl-pds">"</span></span>
  },
  <span class="pl-ent">"dependencies"</span>: {
    <span class="pl-ent">"peertest-c"</span>: <span class="pl-s"><span class="pl-pds">"</span>^1.0.0<span class="pl-pds">"</span></span>
  },
  <span class="pl-ent">"keywords"</span>: [],
  <span class="pl-ent">"author"</span>: <span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span>,
  <span class="pl-ent">"license"</span>: <span class="pl-s"><span class="pl-pds">"</span>ISC<span class="pl-pds">"</span></span>
}</pre></div>
<p dir="auto"><strong>peertest-c/package.json(latest)</strong></p>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
  &quot;name&quot;: &quot;peertest-c&quot;,
  &quot;version&quot;: &quot;1.0.0&quot;,
  &quot;description&quot;: &quot;&quot;,
  &quot;main&quot;: &quot;index.js&quot;,
  &quot;scripts&quot;: {
    &quot;test&quot;: &quot;echo \&quot;Error: no test specified\&quot; &amp;&amp; exit 1&quot;
  },
  &quot;peerDependencies&quot;: {
    &quot;peertest-a&quot;: &quot;&gt;=1.0.0&quot;
  },
  &quot;keywords&quot;: [],
  &quot;author&quot;: &quot;&quot;,
  &quot;license&quot;: &quot;ISC&quot;
}"><pre class="notranslate">{
  <span class="pl-ent">"name"</span>: <span class="pl-s"><span class="pl-pds">"</span>peertest-c<span class="pl-pds">"</span></span>,
  <span class="pl-ent">"version"</span>: <span class="pl-s"><span class="pl-pds">"</span>1.0.0<span class="pl-pds">"</span></span>,
  <span class="pl-ent">"description"</span>: <span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span>,
  <span class="pl-ent">"main"</span>: <span class="pl-s"><span class="pl-pds">"</span>index.js<span class="pl-pds">"</span></span>,
  <span class="pl-ent">"scripts"</span>: {
    <span class="pl-ent">"test"</span>: <span class="pl-s"><span class="pl-pds">"</span>echo <span class="pl-cce">\"</span>Error: no test specified<span class="pl-cce">\"</span> &amp;&amp; exit 1<span class="pl-pds">"</span></span>
  },
  <span class="pl-ent">"peerDependencies"</span>: {
    <span class="pl-ent">"peertest-a"</span>: <span class="pl-s"><span class="pl-pds">"</span>&gt;=1.0.0<span class="pl-pds">"</span></span>
  },
  <span class="pl-ent">"keywords"</span>: [],
  <span class="pl-ent">"author"</span>: <span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span>,
  <span class="pl-ent">"license"</span>: <span class="pl-s"><span class="pl-pds">"</span>ISC<span class="pl-pds">"</span></span>
}</pre></div>
<h3 dir="auto">Expected Behavior</h3>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="cd peer-test
npm i"><pre class="notranslate"><span class="pl-c1">cd</span> peer-test
npm i</pre></div>
<p dir="auto"><strong>expect peer-test/node_modules</strong></p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="node_modules
  -peertest-a 1.0.0
  -peertest-b 1.0.0
  -peertest-c 1.0.0"><pre class="notranslate">node_modules
  -peertest-a 1.0.0
  -peertest-b 1.0.0
  -peertest-c 1.0.0</pre></div>
<p dir="auto"><strong>but the fact is</strong></p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="node_modules
  -peertest-a 1.0.0
  -peertest-b 1.0.0
      -node_modules
        -peertest-c 1.0.0"><pre class="notranslate">node_modules
  -peertest-a 1.0.0
  -peertest-b 1.0.0
      -node_modules
        -peertest-c 1.0.0</pre></div>
<p dir="auto">so , I want to know why peertest-c <code class="notranslate">can not move to ROOT</code>.<br>
But, I change peertest-c <code class="notranslate">peerDependencies</code> to <code class="notranslate">^1.0.0</code>，the result is true.</p>
<h3 dir="auto">Steps To Reproduce</h3>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="cd peer-test
npm i"><pre class="notranslate"><span class="pl-c1">cd</span> peer-test
npm i</pre></div>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>OS: win10</li>
<li>Node: v14.17.5</li>
<li>npm: 8.0.0</li>
</ul>
<h3 dir="auto">Is there an existing issue for this?</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the existing issues</li>
</ul>
<h3 dir="auto">Current Behavior</h3>
<p dir="auto">Currently all of our open source projects and many of our non-open source projects are unable to build because <code class="notranslate">npm</code> 7+ is reifying different file trees based on the publish event of an unrelated module. This meant that all of our builds that were working suddenly stopped working even though no dependencies changed on our side.</p>
<p dir="auto">Here's a reduced test case repo with detailed explanation and steps to repro: <a href="https://github.com/ryanblock/npm-time-based-dependency-graph">https://github.com/ryanblock/npm-time-based-dependency-graph</a></p>
<p dir="auto">Summary:</p>
<ul dir="auto">
<li>This project has two dependencies: <code class="notranslate">eslint@7</code> (which has many subdependencies) + <code class="notranslate">@architect/eslint-config</code>, which has 3 subdependencies:
<ul dir="auto">
<li><code class="notranslate">eslint-plugin-filenames</code></li>
<li><code class="notranslate">eslint-plugin-fp</code></li>
<li><code class="notranslate">eslint-plugin-import</code></li>
</ul>
</li>
<li>When deps before <code class="notranslate">2021-10-09T20:46:00.000Z</code> are installed:
<ul dir="auto">
<li>The 3 <code class="notranslate">eslint-plugin-$name</code> dependencies above are installed flatly into <code class="notranslate">node_modules/</code> (e.g. <code class="notranslate">node_modules/eslint-plugin/filenames</code>)</li>
</ul>
</li>
<li>When deps before <code class="notranslate">2021-10-09T20:47:00.000Z</code> are installed (one minute later):
<ul dir="auto">
<li>The 2 of 3 plugins are installed into <code class="notranslate">node_modules/@architect/eslint-config/node_modules/</code> (specifically <code class="notranslate">eslint-plugin-filenames</code>, <code class="notranslate">eslint-plugin-fp</code>)</li>
<li>The 3rd plugin is still installed flatly into <code class="notranslate">node_modules/</code></li>
</ul>
</li>
<li>eslint then runs, and cannot find <code class="notranslate">eslint-plugin-filenames</code> (nor <code class="notranslate">eslint-plugin-fp</code>, but it fails on the first plugin) because they are both installed in <code class="notranslate">node_modules/@architect/eslint-config/node_modules/</code>, away from the reach of Node's module resolution</li>
<li><strong>Note:</strong> <code class="notranslate">eslint@8</code> DOES NOT appear in this dependency tree anywhere, however it was published at <code class="notranslate">2021-10-09T20:46:13.874Z</code>
<ul dir="auto">
<li>This implies that Arborist / npm is reifying module locations based on the existence of a package that is not even in use in this project</li>
</ul>
</li>
</ul>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">No matter when <code class="notranslate">npm i</code> is run in a project with identical dependencies, the filesystem results should be the same.</p>
<h3 dir="auto">Steps To Reproduce</h3>
<p dir="auto">Steps to reproduce can be found at the following reduced test case repo: <a href="https://github.com/ryanblock/npm-time-based-dependency-graph">https://github.com/ryanblock/npm-time-based-dependency-graph</a></p>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>OS: macOS 11.6</li>
<li>Node: 16.10, 16.11</li>
<li>npm: 7, 8 (does not reproduce in npm 6)</li>
</ul>