Skip to content

Commit 1b45ed0

Browse files
fix(react-email): require Node 20.19 in the dev server runtime check (#3756)
1 parent e9939f0 commit 1b45ed0

4 files changed

Lines changed: 11 additions & 8 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"react-email": patch
3+
---
4+
5+
The dev server now refuses to start on Node older than 20.19, which matches the package's declared minimum, and names the installed version in the error.

‎apps/docs/contributing/development-workflow/1-setup.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ description: 'Things you will need to do beforehand to setup the project'
88
Before you can start developing, you will need to get the project setup.
99

1010
<Info>
11-
To contribute to the project, you must use **Node 18** or higher.
11+
To contribute to the project, you must use **Node 20.19** or higher.
1212
</Info>
1313

1414
<Steps>

‎packages/react-email/src/cli/utils/preview/start-dev-server.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ export const startDevServer = async (
3535
port: number,
3636
compatibilityClients?: string,
3737
): Promise<http.Server> => {
38-
const [majorNodeVersion] = process.versions.node.split('.');
39-
if (majorNodeVersion && Number.parseInt(majorNodeVersion, 10) < 20) {
38+
const [major = 0, minor = 0] = process.versions.node.split('.').map(Number);
39+
if (major < 20 || (major === 20 && minor < 19)) {
4040
console.error(
41-
` ${logSymbols.error} Node ${majorNodeVersion} is not supported. Please upgrade to Node 20 or higher.`,
41+
` ${logSymbols.error} Node ${process.versions.node} is not supported. Please upgrade to Node 20.19 or higher.`,
4242
);
4343
process.exit(1);
4444
}

‎packages/react-email/src/cli/utils/style-text.ts‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
/**
2-
* Centralized fallback for Node versions (<20.12.0) without util.styleText.
3-
* Returns the original text when styleText is unavailable.
4-
*/
1+
// Node below 20.12 has no util.styleText. A static import of it would throw at
2+
// module load, before startDevServer can print its "upgrade Node" message.
53
import * as nodeUtil from 'node:util';
64

75
type StyleTextFunction = typeof nodeUtil.styleText;

0 commit comments

Comments
 (0)