<h1 dir="auto">What / Why</h1>

<blockquote>
<p dir="auto">I've been unable to install anything (e.g. <code class="notranslate">npm install npm-groovy-lint</code>) because of an error that wouldn't go away.</p>
</blockquote>
<h2 dir="auto">When</h2>
<ul dir="auto">
<li>Every time I try <code class="notranslate">npm install $packagename</code></li>
</ul>
<h2 dir="auto">Where</h2>
<ul dir="auto">
<li>n/a</li>
</ul>
<h2 dir="auto">How</h2>
<h3 dir="auto">Current Behavior</h3>

<ul dir="auto">
<li>Type <code class="notranslate">npm install npm-groovy-lint</code>, see 'The package-lock.json file was created with an old version of npm, so supplemental metadata must be fetched from the registry.  This is a one-time fix-up, please be patient...', followed by a long list of packages being checked, followed by an error message:</li>
</ul>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="4065 silly inflate node_modules/edge
4066 silly inflate packages/edge
4067 http fetch GET 200 https://registry.npmjs.org/@types%2fnode 1163ms (cache updated)
4068 silly inflate packages/edge/node_modules/keycloak-js
4069 silly inflate node_modules/cas
4070 silly inflate packages/cas
4071 timing idealTree Completed in 22840ms
4072 timing command:install Completed in 22874ms
4073 notice New ^[[33mminor^[[39m version of npm available! ^[[31m7.23.0^[[39m -&gt; ^[[32m7.24.2^[[39m
4073 notice Changelog: ^[[36mhttps://github.com/npm/cli/releases/tag/v7.24.2^[[39m
4073 notice Run ^[[32mnpm install -g npm@7.24.2^[[39m to update!
4074 verbose stack Error: Tracker &quot;idealTree:inflate:&quot; already exists
4074 verbose stack     at Arborist.[_onError] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/tracker.js:107:11)
4074 verbose stack     at Arborist.addTracker (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/tracker.js:31:21)
4074 verbose stack     at Array.&lt;anonymous&gt; (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:716:14)
4074 verbose stack     at run (/usr/local/lib/node_modules/npm/node_modules/promise-call-limit/index.js:30:26)
4074 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/promise-call-limit/index.js:33:7
4075 verbose cwd /home/chowes/work/ns/management-ui
4076 verbose Linux 5.13.19-200.fc34.x86_64
4077 verbose argv &quot;/usr/bin/node&quot; &quot;/usr/local/bin/npm&quot; &quot;install&quot; &quot;npm-groovy-lint&quot;
4078 verbose node v14.17.6
4079 verbose npm  v7.23.0
4080 error Tracker &quot;idealTree:inflate:&quot; already exists
4081 verbose exit 1"><pre class="notranslate"><code class="notranslate">4065 silly inflate node_modules/edge
4066 silly inflate packages/edge
4067 http fetch GET 200 https://registry.npmjs.org/@types%2fnode 1163ms (cache updated)
4068 silly inflate packages/edge/node_modules/keycloak-js
4069 silly inflate node_modules/cas
4070 silly inflate packages/cas
4071 timing idealTree Completed in 22840ms
4072 timing command:install Completed in 22874ms
4073 notice New ^[[33mminor^[[39m version of npm available! ^[[31m7.23.0^[[39m -&gt; ^[[32m7.24.2^[[39m
4073 notice Changelog: ^[[36mhttps://github.com/npm/cli/releases/tag/v7.24.2^[[39m
4073 notice Run ^[[32mnpm install -g npm@7.24.2^[[39m to update!
4074 verbose stack Error: Tracker "idealTree:inflate:" already exists
4074 verbose stack     at Arborist.[_onError] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/tracker.js:107:11)
4074 verbose stack     at Arborist.addTracker (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/tracker.js:31:21)
4074 verbose stack     at Array.&lt;anonymous&gt; (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:716:14)
4074 verbose stack     at run (/usr/local/lib/node_modules/npm/node_modules/promise-call-limit/index.js:30:26)
4074 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/promise-call-limit/index.js:33:7
4075 verbose cwd /home/chowes/work/ns/management-ui
4076 verbose Linux 5.13.19-200.fc34.x86_64
4077 verbose argv "/usr/bin/node" "/usr/local/bin/npm" "install" "npm-groovy-lint"
4078 verbose node v14.17.6
4079 verbose npm  v7.23.0
4080 error Tracker "idealTree:inflate:" already exists
4081 verbose exit 1
</code></pre></div>
<h3 dir="auto">Steps to Reproduce</h3>

<ul dir="auto">
<li>Install @npmcli/arborist version 2.9.0 : other versions not tested, as couldn't install anything</li>
<li>Have an old lock file</li>
<li>Type <code class="notranslate">npm install npm-groovy-lint</code></li>
</ul>
<h3 dir="auto">Expected Behavior</h3>

<ul dir="auto">
<li>No error, it should "just work"</li>
</ul>
<h3 dir="auto">Steps to Workaround</h3>
<ul dir="auto">
<li>I modified /usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:717</li>
<li>Exact link: <a href="https://github.com/npm/arborist/blob/v2.9.0/lib/arborist/build-ideal-tree.js#L717">https://github.com/npm/arborist/blob/v2.9.0/lib/arborist/build-ideal-tree.js#L717</a></li>
<li>Current git repository link: <a href="https://github.com/npm/arborist/blob/main/lib/arborist/build-ideal-tree.js#L727">https://github.com/npm/arborist/blob/main/lib/arborist/build-ideal-tree.js#L727</a></li>
<li>Old code:</li>
</ul>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="        const t = `idealTree:inflate:${sloc}`
        this.addTracker(t)"><pre class="notranslate"><code class="notranslate">        const t = `idealTree:inflate:${sloc}`
        this.addTracker(t)
</code></pre></div>
<ul dir="auto">
<li>New code:</li>
</ul>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="        const rand = Math.random()
        const t = `idealTree:inflate:${sloc}:${rand}`
        this.addTracker(t)"><pre class="notranslate"><code class="notranslate">        const rand = Math.random()
        const t = `idealTree:inflate:${sloc}:${rand}`
        this.addTracker(t)
</code></pre></div>
<ul dir="auto">
<li>With this change, the error <code class="notranslate">Tracker "idealTree:inflate:" already exists</code> went away.</li>
<li>It appears that the sloc variable was an empty string two times, leading to a duplicate tracker error message.</li>
</ul>
<h2 dir="auto">Who</h2>
<ul dir="auto">
<li>n/a</li>
</ul>
<h2 dir="auto">References</h2>
<ul dir="auto">
<li>n/a</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">After updating the overrides, <code class="notranslate">npm install</code> is not updating the <code class="notranslate">package.lock</code> or <code class="notranslate">node_modules</code>.</p>
<p dir="auto">To make it work I had to remove both <code class="notranslate">package.lock</code> and <code class="notranslate">node_modules</code>, then the overrides have been applied.</p>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">Change in <code class="notranslate">overrides</code> should update <code class="notranslate">package.lock</code> and <code class="notranslate">node_modules</code> after running <code class="notranslate">npm install</code></p>
<h3 dir="auto">Steps To Reproduce</h3>
<ol dir="auto">
<li>Add a dependency</li>
<li>npm install</li>
<li>Add override</li>
<li>npm install</li>
</ol>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>npm: &gt;=8.3.0</li>
<li>Node.js: 16.13.2</li>
<li>OS Name: macOS 12</li>
<li>System Model Name:</li>
<li>npm config:</li>
</ul>
<div class="highlight highlight-source-ini notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="; copy and paste output from `npm config ls` here"><pre class="notranslate"><span class="pl-c"><span class="pl-c">;</span> copy and paste output from `npm config ls` here</span></pre></div>