[BUG] Overrides are not updating after running npm install
Problem
Is there an existing issue for this? - [X] I have searched the existing issues This issue exists in the latest npm version - [X] 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 1. Add a dependency 2. npm install 3. Add override 4. npm install Environment - npm: >=8.3.0 - Node.js: 16.13.2 - OS Name: macOS 12 - System Model Name: - npm config: [code block]
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: [BUG] Overrides are not updating after running npm install
This issue is attracting some general "overrides don't work for me at all" comments in addition to the specific original reported issue, so it might be worth mentioning a couple of things to check for that can cause overrides to not work at all: 1. There's an undocumented limitation of overrides in monorepos with workspaces: `overrides` are only read in the project root package.json; `overrides`
Trust Score
6 verifications
- 1
This issue is attracting some general "overrides don't work for me at all" comme
This issue is attracting some general "overrides don't work for me at all" comments in addition to the specific original reported issue, so it might be worth mentioning a couple of things to check for that can cause overrides to not work at all:
- 2
There's an undocumented limitation of overrides in monorepos with workspaces: `o
2. Overrides weren't released until NPM version 8.3.0 - @grandsilence overrides aren't working for you because you're on npm 8.1.2
- 3
So if it seems overrides don't work at all, and you think this issue might be re
So if it seems overrides don't work at all, and you think this issue might be related, do `npm install -g npm@latest` and check the overrides aren't in a workspace (and hoist them if they are). Then try the steps described above (e.g. deleting package-lock and node_modules, then looking at exactly what's being written to package-lock).
Validation
Resolved in npm/cli GitHub issue #4232. Community reactions: 28 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep