Issue 1:
What / Why

I've been unable to install anything (e.g. npm install npm-groovy-lint) because of an error that wouldn't go away.

When

Every time I try npm install $packagename

Where

n/a

How

Current Behavior

Type npm install npm-groovy-lint, 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:

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 -> ^[[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.<anonymous> (/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

Steps to Reproduce

Install @npmcli/arborist version 2.9.0 : other versions not tested, as couldn't install anything

Have an old lock file

Type npm install npm-groovy-lint

Expected Behavior

No error, it should "just work"

Steps to Workaround

I modified /usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:717

Exact link: https://github.com/npm/arborist/blob/v2.9.0/lib/arborist/build-ideal-tree.js#L717

Current git repository link: https://github.com/npm/arborist/blob/main/lib/arborist/build-ideal-tree.js#L727

Old code:

const t = `idealTree:inflate:${sloc}`
this.addTracker(t)

New code:

const rand = Math.random()
const t = `idealTree:inflate:${sloc}:${rand}`
this.addTracker(t)

With this change, the error Tracker "idealTree:inflate:" already exists went away.

It appears that the sloc variable was an empty string two times, leading to a duplicate tracker error message.

Who

n/a

References

n/a

Issue 2:
Is there an existing issue for this?

I have searched the existing issues

This issue exists in the latest npm version

I am using the latest npm

Current Behavior

After updating the overrides, npm install is not updating the package.lock or node_modules.

To make it work I had to remove both package.lock and node_modules, then the overrides have been applied.

Expected Behavior

Change in overrides should update package.lock and node_modules after running npm install

Steps To Reproduce

Add a dependency

npm install

Add override

npm install

Environment

npm: >=8.3.0

Node.js: 16.13.2

OS Name: macOS 12

System Model Name:

npm config:

; copy and paste output from `npm config ls` here