From 10a197cf8bde65317eda87d5c59a9aced26977c3 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Fri, 25 Feb 2022 10:29:30 -0800 Subject: [PATCH 1/4] Add warning for Yarn PnP v3 with Node.js < 16.14 --- packages/next/bin/next.ts | 13 +++++++++++++ test/e2e/yarn-pnp/test/utils.ts | 6 ++++++ 2 files changed, 19 insertions(+) diff --git a/packages/next/bin/next.ts b/packages/next/bin/next.ts index 283e0996b747..d64d763e6ae7 100755 --- a/packages/next/bin/next.ts +++ b/packages/next/bin/next.ts @@ -105,6 +105,19 @@ if (process.env.NODE_ENV) { ;(process.env as any).NODE_ENV = process.env.NODE_ENV || defaultEnv +// x-ref: https://github.com/vercel/next.js/pull/34688#issuecomment-1047994505 +if (process.versions.pnp === '3') { + const nodeVersionParts = process.versions.node + .split('.') + .map((v) => Number(v)) + + if (nodeVersionParts[0] < 16 || nodeVersionParts[1] < 14) { + log.warn( + 'Starting with Yarn PnP v3.20, Node.js >= v16.14 is required to work correctly see here for more info: https://github.com/vercel/next.js/pull/34688#issuecomment-1047994505' + ) + } +} + // Make sure commands gracefully respect termination signals (e.g. from Docker) process.on('SIGTERM', () => process.exit(0)) process.on('SIGINT', () => process.exit(0)) diff --git a/test/e2e/yarn-pnp/test/utils.ts b/test/e2e/yarn-pnp/test/utils.ts index 1d616f084cd9..4d4f647a9deb 100644 --- a/test/e2e/yarn-pnp/test/utils.ts +++ b/test/e2e/yarn-pnp/test/utils.ts @@ -41,6 +41,12 @@ export function runTests(example = '') { }) afterAll(() => next?.destroy()) + it('should warn on not fully supported node versions', async () => { + expect(next.cliOutput).toContain( + 'Starting with Yarn PnP v3.20, Node.js >= v16.14 is required to work correctly see here for more info' + ) + }) + it(`should compile and serve the index page correctly ${example}`, async () => { const res = await fetchViaHTTP(next.url, '/') expect(res.status).toBe(200) From 68512845c8fec27ac633d60031f23e06e506d4ff Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Fri, 25 Feb 2022 11:05:49 -0800 Subject: [PATCH 2/4] Apply suggestions from code review Co-authored-by: Steven --- packages/next/bin/next.ts | 2 +- test/e2e/yarn-pnp/test/utils.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/next/bin/next.ts b/packages/next/bin/next.ts index d64d763e6ae7..034e64cd0d0b 100755 --- a/packages/next/bin/next.ts +++ b/packages/next/bin/next.ts @@ -113,7 +113,7 @@ if (process.versions.pnp === '3') { if (nodeVersionParts[0] < 16 || nodeVersionParts[1] < 14) { log.warn( - 'Starting with Yarn PnP v3.20, Node.js >= v16.14 is required to work correctly see here for more info: https://github.com/vercel/next.js/pull/34688#issuecomment-1047994505' + 'Node.js 16.14+ is required for Yarn PnP 3.20+. More info: https://github.com/vercel/next.js/pull/34688#issuecomment-1047994505' ) } } diff --git a/test/e2e/yarn-pnp/test/utils.ts b/test/e2e/yarn-pnp/test/utils.ts index 4d4f647a9deb..57ceb10c050e 100644 --- a/test/e2e/yarn-pnp/test/utils.ts +++ b/test/e2e/yarn-pnp/test/utils.ts @@ -43,7 +43,7 @@ export function runTests(example = '') { it('should warn on not fully supported node versions', async () => { expect(next.cliOutput).toContain( - 'Starting with Yarn PnP v3.20, Node.js >= v16.14 is required to work correctly see here for more info' + 'Node.js 16.14+ is required for Yarn PnP 3.20+. More info' ) }) From 5306abe2437a44e3c90d5f82f3428394d409ff93 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Fri, 25 Feb 2022 11:08:00 -0800 Subject: [PATCH 3/4] Apply suggestions from code review Co-authored-by: Steven --- packages/next/bin/next.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/next/bin/next.ts b/packages/next/bin/next.ts index 034e64cd0d0b..e76309d22f12 100755 --- a/packages/next/bin/next.ts +++ b/packages/next/bin/next.ts @@ -111,7 +111,7 @@ if (process.versions.pnp === '3') { .split('.') .map((v) => Number(v)) - if (nodeVersionParts[0] < 16 || nodeVersionParts[1] < 14) { + if (nodeVersionParts[0] < 16 || (nodeVersionParts[0] === 16 && nodeVersionParts[1] < 14)) { log.warn( 'Node.js 16.14+ is required for Yarn PnP 3.20+. More info: https://github.com/vercel/next.js/pull/34688#issuecomment-1047994505' ) From 69cbdcbcdedf7cc78b74db664ff34b509ac243a1 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Fri, 25 Feb 2022 11:17:12 -0800 Subject: [PATCH 4/4] lint-fix --- packages/next/bin/next.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/next/bin/next.ts b/packages/next/bin/next.ts index e76309d22f12..bba1a9c9a009 100755 --- a/packages/next/bin/next.ts +++ b/packages/next/bin/next.ts @@ -111,7 +111,10 @@ if (process.versions.pnp === '3') { .split('.') .map((v) => Number(v)) - if (nodeVersionParts[0] < 16 || (nodeVersionParts[0] === 16 && nodeVersionParts[1] < 14)) { + if ( + nodeVersionParts[0] < 16 || + (nodeVersionParts[0] === 16 && nodeVersionParts[1] < 14) + ) { log.warn( 'Node.js 16.14+ is required for Yarn PnP 3.20+. More info: https://github.com/vercel/next.js/pull/34688#issuecomment-1047994505' )