-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Description
Intro
The purpose of this issue is to serve as the source of truth for the topic related to upgrading the node and npm versions, as well as be the central point for discussing how to move it forward.
See also a related PR in WordPress core: WordPress/wordpress-develop#4028.
Context
Currently, Gutenberg allows the following versions:
The problem is that the recommended node version is in maintenance and the End-of-life is April, 30th, 2023, so it would be great to upgrade it. However, new node versions use npm versions above 6, which are currently blocked due to issues with dependencies (see below under the Blockers section).
Goal
Upgrade to the latest LTS version of node:
node18.14.2npm9.5.0
Or alternatively, if we find blockers using npm 9, upgrade to the latest LTS version that supports npm 8:
node18.13.0npm8.19.3
NOTE: End-of-life of node 18 is 2025-04-30.
Blockers
The main blockers at this point are related to dependencies/peer dependencies, in the following sections are described:
1. @testing-library/react-native dependency ✅
Error logs
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @testing-library/[email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/jest
npm ERR! dev jest@"27.4.5" from the root project
npm ERR! peer jest@"^27.0.0" from [email protected]
npm ERR! node_modules/jest-watch-typeahead
npm ERR! dev jest-watch-typeahead@"1.0.0" from the root project
npm ERR! 7 more (snapshot-diff, @wordpress/e2e-test-utils, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional jest@">=28.0.0" from @testing-library/[email protected]
npm ERR! node_modules/@testing-library/react-native
npm ERR! dev @testing-library/react-native@"11.3.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/jest
npm ERR! peerOptional jest@">=28.0.0" from @testing-library/[email protected]
npm ERR! node_modules/@testing-library/react-native
npm ERR! dev @testing-library/react-native@"11.3.0" from the root project
- Requires
jest@">=28.0.0" - Gutenberg is currently using
[email protected]
🔧 How to solve it: There's an ongoing effort to upgrade Jest version to 29 in #47388, so we can either downgrade the dependency .@testing-library/react-native to a previous version (10.1.1) or wait to the PR to be merged
UPDATE: ✅ This issue has been solved with #47388.
2. react-native dependency ❌
Error logs
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR! dev react@"18.2.0" from the root project
npm ERR! peer react@">=16.8.0" from @emotion/[email protected]
npm ERR! node_modules/@emotion/primitives-core
npm ERR! @emotion/primitives-core@"^11.0.0" from @emotion/[email protected]
npm ERR! node_modules/@emotion/native
npm ERR! dev @emotion/native@"11.0.0" from the root project
npm ERR! 83 more (@emotion/react, @emotion/styled, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"18.0.0" from [email protected]
npm ERR! node_modules/react-native
npm ERR! dev react-native@"0.69.4" from the root project
npm ERR! peer react-native@">=0.14.0 <1" from @emotion/[email protected]
npm ERR! node_modules/@emotion/native
npm ERR! dev @emotion/native@"11.0.0" from the root project
npm ERR! 19 more (@react-native-clipboard/clipboard, ...)
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/react
npm ERR! peer react@"18.0.0" from [email protected]
npm ERR! node_modules/react-native
npm ERR! dev react-native@"0.69.4" from the root project
npm ERR! peer react-native@">=0.14.0 <1" from @emotion/[email protected]
npm ERR! node_modules/@emotion/native
npm ERR! dev @emotion/native@"11.0.0" from the root project
npm ERR! 19 more (@react-native-clipboard/clipboard, ...)
- Requires
react@"18.0.0" - Gutenberg is currently using
[email protected]
🔧 How to solve it: The optimal approach for this would be to upgrade React Native to version 0.71.0. However, in the meantime, we could override the dependency as a workaround.
3. Other warnings related to peer dependencies ⚠️
Warning logs
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @mdx-js/[email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react
npm WARN dev react@"18.2.0" from the root project
npm WARN 86 more (@emotion/primitives-core, @emotion/react, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^16.13.1 || ^17.0.0" from @mdx-js/[email protected]
npm WARN node_modules/@mdx-js/react
npm WARN @mdx-js/react@"^1.6.22" from @storybook/[email protected]
npm WARN node_modules/@storybook/addon-docs
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react
npm WARN peer react@"^16.13.1 || ^17.0.0" from @mdx-js/[email protected]
npm WARN node_modules/@mdx-js/react
npm WARN @mdx-js/react@"^1.6.22" from @storybook/[email protected]
npm WARN node_modules/@storybook/addon-docs
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/ajv
npm WARN dev ajv@"8.7.1" from the root project
npm WARN 4 more (ajv-draft-04, ajv-errors, ajv-formats, table)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer ajv@"^6.9.1" from [email protected]
npm WARN node_modules/ajv-keywords
npm WARN ajv-keywords@"^3.4.1" from [email protected]
npm WARN node_modules/@storybook/core-common/node_modules/webpack
npm WARN 4 more (webpack, webpack, schema-utils, schema-utils)
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/ajv
npm WARN peer ajv@"^6.9.1" from [email protected]
npm WARN node_modules/ajv-keywords
npm WARN ajv-keywords@"^3.4.1" from [email protected]
npm WARN node_modules/@storybook/core-common/node_modules/webpack
npm WARN 4 more (webpack, webpack, schema-utils, schema-utils)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react
npm WARN dev react@"18.2.0" from the root project
npm WARN 86 more (@emotion/primitives-core, @emotion/react, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^0.14.8 || ^15.0.1 || ^16.0.0 || ^17.0.1" from [email protected]
npm WARN node_modules/react-element-to-jsx-string
npm WARN react-element-to-jsx-string@"^14.3.4" from @storybook/[email protected]
npm WARN node_modules/@storybook/react
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react
npm WARN peer react@"^0.14.8 || ^15.0.1 || ^16.0.0 || ^17.0.1" from [email protected]
npm WARN node_modules/react-element-to-jsx-string
npm WARN react-element-to-jsx-string@"^14.3.4" from @storybook/[email protected]
npm WARN node_modules/@storybook/react
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react-dom
npm WARN dev react-dom@"18.2.0" from the root project
npm WARN 52 more (@floating-ui/react-dom, @react-spring/web, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react-dom@"^0.14.8 || ^15.0.1 || ^16.0.0 || ^17.0.1" from [email protected]
npm WARN node_modules/react-element-to-jsx-string
npm WARN react-element-to-jsx-string@"^14.3.4" from @storybook/[email protected]
npm WARN node_modules/@storybook/react
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react-dom
npm WARN peer react-dom@"^0.14.8 || ^15.0.1 || ^16.0.0 || ^17.0.1" from [email protected]
npm WARN node_modules/react-element-to-jsx-string
npm WARN react-element-to-jsx-string@"^14.3.4" from @storybook/[email protected]
npm WARN node_modules/@storybook/react
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react
npm WARN dev react@"18.2.0" from the root project
npm WARN 86 more (@emotion/primitives-core, @emotion/react, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^16.8.4 || ^17.0.0" from [email protected]
npm WARN node_modules/react-inspector
npm WARN react-inspector@"^5.1.0" from @storybook/[email protected]
npm WARN node_modules/@storybook/addon-actions
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react
npm WARN peer react@"^16.8.4 || ^17.0.0" from [email protected]
npm WARN node_modules/react-inspector
npm WARN react-inspector@"^5.1.0" from @storybook/[email protected]
npm WARN node_modules/@storybook/addon-actions
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/webpack
npm WARN dev webpack@"5.65.0" from the root project
npm WARN 35 more (@pmmmwh/react-refresh-webpack-plugin, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer webpack@"^2.0.0 || ^3.0.0 || ^4.0.0" from [email protected]
npm WARN node_modules/webpack-filter-warnings-plugin
npm WARN webpack-filter-warnings-plugin@"^1.2.1" from @storybook/[email protected]
npm WARN node_modules/@storybook/builder-webpack4
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/webpack
npm WARN peer webpack@"^2.0.0 || ^3.0.0 || ^4.0.0" from [email protected]
npm WARN node_modules/webpack-filter-warnings-plugin
npm WARN webpack-filter-warnings-plugin@"^1.2.1" from @storybook/[email protected]
npm WARN node_modules/@storybook/builder-webpack4
🔧 How to solve it: It's likely that these warnings won't block using npm 8 but it would be interesting to address them in the future, especially for using npm 9.
Affected dependencies:
@mdx-js/reactajv-keywordsreact-element-to-jsx-stringreact-inspectorwebpack-filter-warnings-plugin
Related opened issues/PRs
- Packages: Unify peer dependencies between React Native packages #34801
- Allow developing Gutenberg with NPM v7 and v8 #46400
- Dependency conflict when installing dependencies using npm 8 #46443
- Cannot
npm installwith npm 7 and higher #46652 - Packages: Issues with peer dependencies with npm7+ after React 18 upgrade #48009
- [RNMobile] Test npm v8 #40517
- Fix dependency conflicts to allow using NPM 7 and 8 #47712
NOTE: Please feel free to edit the above with issues/PRs related to this topic.