-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dependency conflict when installing dependencies using npm 8 #46443
Comments
|
I tried to install the dependencies again with npm 8 but found new issues:
|
It looks like we would miss out on a lot of bug fixes: https://github.com/facebook/react/blob/main/CHANGELOG.md I'm not sure if any of these were critical to getting React working in Gutenberg, but it'd definitely be nice to have them. Out of curiosity, when would we expect to be able to do another React Native upgrade? (Though I do know react native is a huge pain to upgrade!) I also see in this PR (#46576) that legacy-peer-deps could be enabled for the time being, just so there is a base to work off of. While not ideal in the long-run, maybe ok for now as we get everything updated and start chipping away at peer dependency issues? All that said, in my experience with these types of projects (where we start to enforce peer dependencies), we've generally had to include some way to override some broken peer dependencies which we manually verify. For example Yarn has the I think NPM has some similar features too, so I wonder if we could override the React version required by React Native with Obviously we'd need to test that react native works, but could be worth it in this case. There will probably be some similar packages we rely on which haven't yet declared support for React 18, or even React 17. I guess the main downside is that you're not following what the library technically supports, but in this case, it seems like React Native is probably just very cautious rather than explicitly saying React 18.2 isn't supported. |
React Native did the peer dependency update from 18.0.0 to 18.2.0 in this commit. It doesn't just update the dependency, but also synchronizes many changes from React to React Native's renderer. Which is the mobile equivalent of the So, our How is that possible? It's because in React all the hard work is done by the function useState(initialState) {
var dispatcher = resolveDispatcher();
return dispatcher.useState(initialState);
} This code hasn't changed between 18.0.0 and 18.2.0. So the conclusion is that we can safely override or ignore the 18.0.0 peer dependency.
This doesn't look like a good tradeoff to me: downgrading React, which has already been shipped in the Gutenberg plugin and will be shipped in Core soon, and which powers user-visible features, only to be able to upgrade NPM, which is a build tool invisible outside the Gutenberg repo and doesn't affect any published artifacts? I'd rather either postpone the NPM upgrade, or do the React Native upgrade to unblock it.
Do we know what exactly the React Native upgrade from 0.69.4 to 0.71.1 would mean? Is it only a matter of the Gutenberg repo, or does it spread also to other |
Thanks @noahtallen @jsnajdr for checking this, I really appreciate it 🙇 .
Yep, this could be a temporary solution until we fix the dependency issues.
I tried using the
Interesting results, thank you very much @jsnajdr for investigating this. With this information, seems that the option of overriding the dependencies would work until we provide a fix.
Good point, let's discard this option.
Postponing NPM upgrade can't be risky as the currently supported Node version (node 14) is in maintenance and the End-of-life is April, 30th, 2023. Hence, we'd need to upgrade React Native before that date. We could try to prioritize the upgrade in the Gutenberg Mobile project but most of the bandwidth is focused on other projects, so this option can be a bit tight in the schedule. Being this said, I'll prepare a PR as a follow-up on these comments and to address this issue using the option of overriding the dependencies. Following my previous comment, I'd like to make an update because I spotted more issues when installing the dependencies:
|
Done in #47425 👍 |
Description
Part of Upgrade node and npm to latest LTS versions.
Related to #46400 and now that #40540 is solved, I tried installing the dependencies using npm
8.19.3
(node version14.20.1
). The first time I rannpm i
it worked but the second time I encountered the following error:Based on the error logs, looks like there's a dependency conflict in
@storybook/addon-knobs
with the React versions.Step-by-step reproduction instructions
npm i -g npm@8
).npm i
.npm i
again.Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: