Current Behavior:
Running npm install ../localpkg && rpm remove localpkg results in entries for ../localpkg being left behind in package-lock.json even though the module has been completely removed.
Expected Behavior:
In NPM 6.x (and in 7.x for non-local packages), their entries are removed from package-lock.json when a package is removed. This behaviour should also apply to packages installed from a local folder.
Steps To Reproduce:
git stash (to start with a clean repo)
npm install ../some-package
npm remove ../some-package
git diff package-lock.json
- Observe there are now new entries in
package-lock.json for ../some-package even though it was removed.
My use case is that for local development, I am removing a module from my project and installing a local version of it for development, so that I can work on both my code and the module code concurrently. When I am ready to deploy, I then remove the local version and install the published version. However while this used to work fine with NPM 6.x, since upgrading to 7.x it now always leaves behind unwanted entries in package-lock.json for the version in the local folder I was using temporarily.
I am currently using either git or a text editor to remove these extra entries from package-lock.json. Running npm install does not put them back or complain, confirming that they are unnecessary, so it would be nice if npm took care of this automatically like it did in 6.x.
Environment:
- OS: Arch Linux
- Node: 15.14.0
- npm: 7.9.0 and 7.10.0
Current Behavior:
Running
npm install ../localpkg && rpm remove localpkgresults in entries for../localpkgbeing left behind inpackage-lock.jsoneven though the module has been completely removed.Expected Behavior:
In NPM 6.x (and in 7.x for non-local packages), their entries are removed from
package-lock.jsonwhen a package is removed. This behaviour should also apply to packages installed from a local folder.Steps To Reproduce:
git stash(to start with a clean repo)npm install ../some-packagenpm remove ../some-packagegit diff package-lock.jsonpackage-lock.jsonfor../some-packageeven though it was removed.My use case is that for local development, I am removing a module from my project and installing a local version of it for development, so that I can work on both my code and the module code concurrently. When I am ready to deploy, I then remove the local version and install the published version. However while this used to work fine with NPM 6.x, since upgrading to 7.x it now always leaves behind unwanted entries in
package-lock.jsonfor the version in the local folder I was using temporarily.I am currently using either git or a text editor to remove these extra entries from
package-lock.json. Runningnpm installdoes not put them back or complain, confirming that they are unnecessary, so it would be nice ifnpmtook care of this automatically like it did in 6.x.Environment: