From afc91de79a8804696f05219214e0e67235d34d77 Mon Sep 17 00:00:00 2001 From: Rob Hogan Date: Mon, 20 Feb 2023 09:47:24 -0800 Subject: [PATCH] Breaking - Bump minimum Node version from 14 to 16 (#36217) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/36217 ## Bump minimum Node JS version to 16 via `react-native/package.json#engines` In https://github.com/facebook/react-native/pull/35443 we stopped running CI in Node 14 - this follows up by formally making Node 16 the minimum supported version ahead of the 0.72 cut. Node 14 [ends maintenance releases in April](https://github.com/nodejs/release#release-schedule), and bumping this minimum will allow other associated Node JS tools (CLI, Metro, Jest) to reduce their support burden. ## Insert `engines` into `template/package.json` The constraint at `react-native/package.json#engines` ensures the minimum at install/init time, with package managers providing an actionable error or warning if the constraint is not met. However, it doesn't help guide users to a supported version if on an existing project they run (e.g.) `yarn start`. Adding a constraint to the template helps prevent accidental use of an older version, as well as providing a clear reference for the current minimum. Insertion of `engines` below existing `package.json` fields is consistent with [`sort-package-json`](https://github.com/keithamus/sort-package-json/blob/main/defaultRules.md) and [`prettier-package-json`](https://github.com/cameronhunter/prettier-package-json/blob/main/src/defaultOptions.ts) - and keeps it out of the way of fields RN developers are likely to be more concerned about. ## Docs PR https://github.com/facebook/react-native-website/pull/3580 ## Changelog: [General][Breaking] Bump minimum Node JS version to 16 Reviewed By: jacdebug Differential Revision: D43436883 fbshipit-source-id: 0b369487fe44fe777e6fedc2299973a5fddd06b2 --- package.json | 2 +- template/package.json | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 6a8c70926ad977..a57a338e3f0325 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "license": "MIT", "repository": "github:facebook/react-native", "engines": { - "node": ">=14" + "node": ">=16" }, "types": "types", "jest-junit": { diff --git a/template/package.json b/template/package.json index cf3b10d19e9e0e..817c5fccb243cd 100644 --- a/template/package.json +++ b/template/package.json @@ -28,5 +28,8 @@ "prettier": "^2.4.1", "react-test-renderer": "18.2.0", "typescript": "4.8.4" + }, + "engines": { + "node": ">=16" } }