<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">I am unable to install a package (<code class="notranslate">@jest/core</code>) With a caret range (<code class="notranslate">@jest/core@^27.0.1</code>). When I do so, I get the <code class="notranslate">notarget</code> error.</p>
<h3 dir="auto">Debug Log</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    0 verbose cli [
    0 verbose cli   '/Users/apple/.nvm/versions/node/v16.3.0/bin/node',
    0 verbose cli   '/Users/apple/.nvm/versions/node/v16.3.0/bin/npm',
    0 verbose cli   'i',
    0 verbose cli   '@jest/core@^27.0.1'
    0 verbose cli ]
    1 info using npm@7.11.2
    2 info using node@v16.3.0
    3 timing npm:load:whichnode Completed in 1ms
    4 timing config:load:defaults Completed in 2ms
    5 timing config:load:file:/Users/apple/.nvm/versions/node/v16.3.0/lib/node_modules/npm/npmrc Completed in 2ms
    6 timing config:load:builtin Completed in 2ms
    7 timing config:load:cli Completed in 2ms
    8 timing config:load:env Completed in 0ms
    9 timing config:load:file:/Users/apple/Sites/Projects/npm-bug-test/.npmrc Completed in 0ms
    10 timing config:load:project Completed in 1ms
    11 verbose config init.author.name Use `--init-author-name` instead.
    12 verbose config init.author.email Use `--init-author-email` instead.
    13 verbose config init.author.url Use `--init-author-url` instead.
    14 verbose config init.license Use `--init-license` instead.
    15 timing config:load:file:/Users/apple/.npmrc Completed in 2ms
    16 timing config:load:user Completed in 2ms
    17 timing config:load:file:/Users/apple/.nvm/versions/node/v16.3.0/etc/npmrc Completed in 0ms
    18 timing config:load:global Completed in 1ms
    19 timing config:load:validate Completed in 1ms
    20 timing config:load:credentials Completed in 1ms
    21 timing config:load:setEnvs Completed in 1ms
    22 timing config:load Completed in 13ms
    23 timing npm:load:configload Completed in 13ms
    24 timing npm:load:setTitle Completed in 25ms
    25 timing npm:load:setupLog Completed in 0ms
    26 timing npm:load:cleanupLog Completed in 2ms
    27 timing npm:load:configScope Completed in 0ms
    28 timing npm:load:projectScope Completed in 0ms
    29 timing npm:load Completed in 43ms
    30 timing config:load:flatten Completed in 3ms
    31 timing arborist:ctor Completed in 1ms
    32 timing arborist:ctor Completed in 0ms
    33 timing idealTree:init Completed in 14ms
    34 timing idealTree:userRequests Completed in 5ms
    35 silly idealTree buildDeps
    36 silly fetch manifest @jest/core@^27.0.1
    37 http fetch GET 200 https://registry.npmjs.org/@jest%2fcore 73ms (from cache)
    38 silly placeDep ROOT @jest/core@ OK for: npm-bug-test@1.0.0 want: ^27.0.1
    39 timing idealTree:#root Completed in 85ms
    40 timing idealTree:node_modules/@jest/core Completed in 0ms
    41 timing idealTree:buildDeps Completed in 86ms
    42 timing idealTree:fixDepFlags Completed in 1ms
    43 timing idealTree Completed in 107ms
    44 timing command:install Completed in 119ms
    45 verbose type range
    46 verbose stack @jest/core: No matching version found for @jest/core@^27.0.1.
    46 verbose stack     at module.exports (/Users/apple/.nvm/versions/node/v16.3.0/lib/node_modules/npm/node_modules/npm-pick-manifest/index.js:209:23)
    46 verbose stack     at /Users/apple/.nvm/versions/node/v16.3.0/lib/node_modules/npm/node_modules/pacote/lib/registry.js:118:26
    46 verbose stack     at async Arborist.[nodeFromEdge] (/Users/apple/.nvm/versions/node/v16.3.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:946:19)
    46 verbose stack     at async Arborist.[buildDepStep] (/Users/apple/.nvm/versions/node/v16.3.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:892:11)
    46 verbose stack     at async Arborist.buildIdealTree (/Users/apple/.nvm/versions/node/v16.3.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:218:7)
    46 verbose stack     at async Promise.all (index 1)
    46 verbose stack     at async Arborist.reify (/Users/apple/.nvm/versions/node/v16.3.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:135:5)
    46 verbose stack     at async Install.install (/Users/apple/.nvm/versions/node/v16.3.0/lib/node_modules/npm/lib/install.js:137:5)
    47 verbose cwd /Users/apple/Sites/Projects/npm-bug-test
    48 verbose Darwin 16.7.0
    49 verbose argv &quot;/Users/apple/.nvm/versions/node/v16.3.0/bin/node&quot; &quot;/Users/apple/.nvm/versions/node/v16.3.0/bin/npm&quot; &quot;i&quot; &quot;@jest/core@^27.0.1&quot;
    50 verbose node v16.3.0
    51 verbose npm  v7.11.2
    52 error code ETARGET
    53 error notarget No matching version found for @jest/core@^27.0.1.
    54 error notarget In most cases you or one of your dependencies are requesting
    54 error notarget a package version that doesn't exist.
    55 verbose exit 1"><pre lang="log" class="notranslate"><code class="notranslate">    0 verbose cli [
    0 verbose cli   '/Users/apple/.nvm/versions/node/v16.3.0/bin/node',
    0 verbose cli   '/Users/apple/.nvm/versions/node/v16.3.0/bin/npm',
    0 verbose cli   'i',
    0 verbose cli   '@jest/core@^27.0.1'
    0 verbose cli ]
    1 info using npm@7.11.2
    2 info using node@v16.3.0
    3 timing npm:load:whichnode Completed in 1ms
    4 timing config:load:defaults Completed in 2ms
    5 timing config:load:file:/Users/apple/.nvm/versions/node/v16.3.0/lib/node_modules/npm/npmrc Completed in 2ms
    6 timing config:load:builtin Completed in 2ms
    7 timing config:load:cli Completed in 2ms
    8 timing config:load:env Completed in 0ms
    9 timing config:load:file:/Users/apple/Sites/Projects/npm-bug-test/.npmrc Completed in 0ms
    10 timing config:load:project Completed in 1ms
    11 verbose config init.author.name Use `--init-author-name` instead.
    12 verbose config init.author.email Use `--init-author-email` instead.
    13 verbose config init.author.url Use `--init-author-url` instead.
    14 verbose config init.license Use `--init-license` instead.
    15 timing config:load:file:/Users/apple/.npmrc Completed in 2ms
    16 timing config:load:user Completed in 2ms
    17 timing config:load:file:/Users/apple/.nvm/versions/node/v16.3.0/etc/npmrc Completed in 0ms
    18 timing config:load:global Completed in 1ms
    19 timing config:load:validate Completed in 1ms
    20 timing config:load:credentials Completed in 1ms
    21 timing config:load:setEnvs Completed in 1ms
    22 timing config:load Completed in 13ms
    23 timing npm:load:configload Completed in 13ms
    24 timing npm:load:setTitle Completed in 25ms
    25 timing npm:load:setupLog Completed in 0ms
    26 timing npm:load:cleanupLog Completed in 2ms
    27 timing npm:load:configScope Completed in 0ms
    28 timing npm:load:projectScope Completed in 0ms
    29 timing npm:load Completed in 43ms
    30 timing config:load:flatten Completed in 3ms
    31 timing arborist:ctor Completed in 1ms
    32 timing arborist:ctor Completed in 0ms
    33 timing idealTree:init Completed in 14ms
    34 timing idealTree:userRequests Completed in 5ms
    35 silly idealTree buildDeps
    36 silly fetch manifest @jest/core@^27.0.1
    37 http fetch GET 200 https://registry.npmjs.org/@jest%2fcore 73ms (from cache)
    38 silly placeDep ROOT @jest/core@ OK for: npm-bug-test@1.0.0 want: ^27.0.1
    39 timing idealTree:#root Completed in 85ms
    40 timing idealTree:node_modules/@jest/core Completed in 0ms
    41 timing idealTree:buildDeps Completed in 86ms
    42 timing idealTree:fixDepFlags Completed in 1ms
    43 timing idealTree Completed in 107ms
    44 timing command:install Completed in 119ms
    45 verbose type range
    46 verbose stack @jest/core: No matching version found for @jest/core@^27.0.1.
    46 verbose stack     at module.exports (/Users/apple/.nvm/versions/node/v16.3.0/lib/node_modules/npm/node_modules/npm-pick-manifest/index.js:209:23)
    46 verbose stack     at /Users/apple/.nvm/versions/node/v16.3.0/lib/node_modules/npm/node_modules/pacote/lib/registry.js:118:26
    46 verbose stack     at async Arborist.[nodeFromEdge] (/Users/apple/.nvm/versions/node/v16.3.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:946:19)
    46 verbose stack     at async Arborist.[buildDepStep] (/Users/apple/.nvm/versions/node/v16.3.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:892:11)
    46 verbose stack     at async Arborist.buildIdealTree (/Users/apple/.nvm/versions/node/v16.3.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:218:7)
    46 verbose stack     at async Promise.all (index 1)
    46 verbose stack     at async Arborist.reify (/Users/apple/.nvm/versions/node/v16.3.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:135:5)
    46 verbose stack     at async Install.install (/Users/apple/.nvm/versions/node/v16.3.0/lib/node_modules/npm/lib/install.js:137:5)
    47 verbose cwd /Users/apple/Sites/Projects/npm-bug-test
    48 verbose Darwin 16.7.0
    49 verbose argv "/Users/apple/.nvm/versions/node/v16.3.0/bin/node" "/Users/apple/.nvm/versions/node/v16.3.0/bin/npm" "i" "@jest/core@^27.0.1"
    50 verbose node v16.3.0
    51 verbose npm  v7.11.2
    52 error code ETARGET
    53 error notarget No matching version found for @jest/core@^27.0.1.
    54 error notarget In most cases you or one of your dependencies are requesting
    54 error notarget a package version that doesn't exist.
    55 verbose exit 1
</code></pre></div>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">The correct package is installed.</p>
<h3 dir="auto">Steps To Reproduce</h3>
<ol dir="auto">
<li>Init npm – <code class="notranslate">npm init</code></li>
<li>Run <code class="notranslate">npm i @jest/core@^27.0.1</code></li>
<li>See error</li>
</ol>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>OS: MacOS 10.12</li>
<li>Node: 16.3.0</li>
<li>npm: 7.11.2</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">This issue exists in the latest npm version</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I am using the latest npm</li>
</ul>
<h3 dir="auto">Current Behavior</h3>
<p dir="auto">The artifacts of a merge conflict (<code class="notranslate">&lt;&lt;&lt;&lt; HEAD</code>, <code class="notranslate">||||</code>, <code class="notranslate">====</code>, <code class="notranslate">&gt;&gt;&gt;&gt;&gt; &lt;hash&gt;</code>) in a <code class="notranslate">package-lock.json</code> file were accidentally committed to my repository. Running <code class="notranslate">npm ci</code> succeeded with no issues, even though the <code class="notranslate">version</code> and <code class="notranslate">integrity</code> fields were duplicated in a JSON object, and non-JSON compliant text was present.</p>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">If the JSON in a <code class="notranslate">package-lock.json</code> file is malformed, I expect <code class="notranslate">npm ci</code> to exit with a non-zero exit code. That is the behavior of NPM v6.14.16, but not NPM v7 or v8.</p>
<h3 dir="auto">Steps To Reproduce</h3>
<ol dir="auto">
<li>In this environment, with <a href="https://github.com/npm/cli/files/8613036/npm-stuff.zip">this zip file</a> extracted into an empty folder (contains a minimal <code class="notranslate">package.json</code> and <code class="notranslate">package-lock.json</code> to reproduce the bug).</li>
<li>With this config, using any NPM version more recent than <code class="notranslate">7.0.0</code>.</li>
<li>Run <code class="notranslate">npm ci</code>.</li>
<li>And see that no error is reported.</li>
<li>If you install NPM &lt; <code class="notranslate">7.0.0</code>, like <code class="notranslate">6.14.16</code>, running <code class="notranslate">npm ci</code> <em>does</em> throw an error.</li>
</ol>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>npm: 8.5.1 (present starting in 7.0.0 up to 8.8.0)</li>
<li>Node.js: 14.19.1</li>
<li>OS Name: Ubuntu 20.04.4</li>
<li>System Model Name: Dell Precision 7560</li>
<li>npm config:</li>
</ul>
<div class="highlight highlight-source-ini notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="; &quot;user&quot; config from $HOME/.npmrc

(obfuscated):registry = &quot;https://npm.pkg.github.com&quot; 
//npm.pkg.github.com/:_authToken = (protected) 

; node bin location = /usr/bin/node
; cwd = $HOME/playground/npm-test
; HOME = /home/(user)
; Run `npm config ls -l` to show all defaults."><pre class="notranslate"><span class="pl-c"><span class="pl-c">;</span> "user" config from $HOME/.npmrc</span>

(obfuscated):<span class="pl-k">registry</span> = <span class="pl-s"><span class="pl-pds">"</span>https://npm.pkg.github.com<span class="pl-pds">"</span></span> 
//npm.pkg.github.com/:<span class="pl-k">_authToken</span> = (protected) 

<span class="pl-c"><span class="pl-c">;</span> node bin location = /usr/bin/node</span>
<span class="pl-c"><span class="pl-c">;</span> cwd = $HOME/playground/npm-test</span>
<span class="pl-c"><span class="pl-c">;</span> HOME = /home/(user)</span>
<span class="pl-c"><span class="pl-c">;</span> Run `npm config ls -l` to show all defaults.</span></pre></div>