Skip to content
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

Add warning for Yarn PnP v3 with Node.js < 16.14 #34818

Merged
merged 5 commits into from Feb 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions packages/next/bin/next.ts
Expand Up @@ -105,6 +105,22 @@ 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[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'
)
}
}

// Make sure commands gracefully respect termination signals (e.g. from Docker)
process.on('SIGTERM', () => process.exit(0))
process.on('SIGINT', () => process.exit(0))
Expand Down
6 changes: 6 additions & 0 deletions test/e2e/yarn-pnp/test/utils.ts
Expand Up @@ -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(
'Node.js 16.14+ is required for Yarn PnP 3.20+. More info'
)
})

it(`should compile and serve the index page correctly ${example}`, async () => {
const res = await fetchViaHTTP(next.url, '/')
expect(res.status).toBe(200)
Expand Down