From d8640920f32b7ef5e2c2a2dbdd3fd9fdbae6ebc8 Mon Sep 17 00:00:00 2001 From: Phil Edwards Date: Wed, 27 Sep 2023 14:29:35 -0400 Subject: [PATCH] Fix peerDependency ERR from Reflux in npm >= 8.6.0 "overrides": { "reflux": { "react": "$react"} }, This tells npm that Reflux should use our project-level version of React to resolve its dependency on "react". This override applies even though our project-level React (16) falls outside of the semver range that Reflux wants (^15.0.2). Alternatively, this would work: "overrides": { "react": "$react" }, However, the next time we upgrade React, I'd like to see warnings from other libraries (if applicable) so we can be sure to upgrade them. We override this for Reflux because it's not likely to receive updates, yet it tends to continue to work with newer versions of React without any problem. References: overrides on npm https://docs.npmjs.com/cli/v10/configuring-npm/package-json#overrides Helpful comment on the Node breakage thread https://github.com/npm/cli/issues/4998#issuecomment-1155261806 The error you'd see when using npm >= 8.6.0 looked like: npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: reflux@6.4.1 npm ERR! Found: react@16.13.1 --- package.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/package.json b/package.json index c4273172e3..3f5a537d60 100644 --- a/package.json +++ b/package.json @@ -160,6 +160,11 @@ "webpack-dev-server": "^4.8.1", "webpack-extract-translation-keys-plugin": "^6.0.0" }, + "overrides": { + "reflux": { + "react": "$react" + } + }, "scripts": { "preinstall": "npm run hint", "postinstall": "patch-package && npm run copy-fonts",