<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"><code class="notranslate">npm x -q --yes --package=&lt;package&gt;@&lt;version&gt; -- &lt;command&gt;</code> doesn't honor <code class="notranslate">&lt;version&gt;</code>, uses incompatible package that is locally available instead.</p>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto"><code class="notranslate">npm x -q --yes --package=&lt;package&gt;@&lt;version&gt; -- &lt;command&gt;</code> honors <code class="notranslate">&lt;version&gt;</code>, does not uses incompatible package that is locally available instead.</p>
<h3 dir="auto">Steps To Reproduce</h3>
<ol dir="auto">
<li>Write this <code class="notranslate">package.json</code>:
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
  &quot;private&quot;: true,
  &quot;devDependencies&quot;: {
    &quot;pnpm&quot;: &quot;=6.12.1&quot;
  }
}"><pre class="notranslate">{
  <span class="pl-ent">"private"</span>: <span class="pl-c1">true</span>,
  <span class="pl-ent">"devDependencies"</span>: {
    <span class="pl-ent">"pnpm"</span>: <span class="pl-s"><span class="pl-pds">"</span>=6.12.1<span class="pl-pds">"</span></span>
  }
}</pre></div>
</li>
<li>Run <code class="notranslate">npm i</code></li>
<li><code class="notranslate">pnpm@6.12.1</code> is now installed locally.
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$ npm x  -q --yes -- pnpm --version
6.12.1"><pre class="notranslate">$ npm x  -q --yes -- pnpm --version
6.12.1</pre></div>
</li>
<li>Run pnpm 6.13.0 now: <code class="notranslate">npm x</code> won't honor the version
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$ npm x -q --yes --package=&quot;pnpm@6.13.0&quot; -- pnpm --version
6.12.1"><pre class="notranslate">$ npm x -q --yes --package=<span class="pl-s"><span class="pl-pds">"</span>pnpm@6.13.0<span class="pl-pds">"</span></span> -- pnpm --version
6.12.1</pre></div>
</li>
</ol>
<p dir="auto">The docs for <code class="notranslate">npm exec</code> state:</p>
<blockquote>
<p dir="auto">Package names provided without a specifier will be matched with whatever version exists in the local project. <strong>Package names with a specifier will only be considered a match if they have the exact same name and version as the local dependency.</strong></p>
</blockquote>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>OS: macOS 11.4</li>
<li>Node: 16.5.0</li>
<li>npm: 7.21.0</li>
</ul>
<h3 dir="auto">Current Behavior:</h3>
<p dir="auto">running <code class="notranslate">npx @package@version</code> generate it with the current install version</p>
<h3 dir="auto">Expected Behavior:</h3>
<p dir="auto">it should be generated with the given version</p>
<h3 dir="auto">Steps To Reproduce:</h3>
<p dir="auto">ex. steps to reproduce the behavior:</p>
<ol dir="auto">
<li>run <code class="notranslate">npm i -g npm@latest</code> to install npm 7</li>
<li>run <code class="notranslate">npx @angular/cli@next new</code></li>
<li>answer all questions of the angular cli, it doesn't matter what the answers are</li>
<li>it will install angular 11 (while next is 12)</li>
</ol>
<h3 dir="auto">Environment:</h3>
<ul dir="auto">
<li>OS: Windows 10</li>
<li>Node: 14.16.1</li>
<li>npm: 7.12.0 (working fine with 6.14.13)</li>
</ul>