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

Docs: upgrade minumum Node.js version in the docs #42729

Closed
Amasoken opened this issue Nov 10, 2022 · 3 comments · Fixed by #48545
Closed

Docs: upgrade minumum Node.js version in the docs #42729

Amasoken opened this issue Nov 10, 2022 · 3 comments · Fixed by #48545
Labels
kind: bug Confirmed bug that is on the backlog Runtime Related to Node.js or Edge Runtime with Next.js. Upstream Related to using Next.js with a third-party dependency. (e.g., React, UI/icon libraries, etc.).

Comments

@Amasoken
Copy link

What is the improvement or update you wish to see?

Currently the minimum version of Node.js is specified in the docs as 14.0.0 or 14.6.0:

I've been using Node.js v14.17.6 and I've run into the issue with middleware which is described in the section below.
I've spent some time trying to resolve the issue. After that I've checked the specified minimum Node.js versions and my Node.js was above the minimum so I didn't think it was a problem with Node.
After some more digging I've upgraded Node.js to v14.18.0 and it worked.

I think it would be good to specify the actual required minimum version in the docs that works with Next.js 13

Is there any context that might help us understand?

The issue is present on the Node.js v14.17.6 and below, including the minimum v14.6.0. Checked on Next.js 13.0.2 and 13.0.3-canary.3
It seems to work fine on the Node.js v14.18.0 and above.

Steps to reproduce:

  • Create a Next.js project from the standard template yarn create next-app
  • Add middleware.ts file with the simple middleware:
import { NextResponse } from 'next/server';
import type { NextRequest } from 'next/server';

export const middleware = async (req: NextRequest) => {
    console.log('Got request in the middleware');

    return NextResponse.next();
};

export const config = {
    matcher: '/api/:path*',
};
  • Start the app using yarn dev
  • Try to access the api route http://localhost:3000/api/hello

After that there's a following error:

Error [TypeError]: Class extends value undefined is not a constructor or null
      at ../../node_modules/.pnpm/undici@5.11.0/node_modules/undici/lib/fetch/file.js (evalmachine.<anonymous>:5724:19)
      at __require (evalmachine.<anonymous>:14:50)
      at ../../node_modules/.pnpm/undici@5.11.0/node_modules/undici/lib/fetch/formdata.js (evalmachine.<anonymous>:5881:49)
      at __require (evalmachine.<anonymous>:14:50)
      at ../../node_modules/.pnpm/undici@5.11.0/node_modules/undici/lib/fetch/body.js (evalmachine.<anonymous>:6094:35)
      at __require (evalmachine.<anonymous>:14:50)
      at ../../node_modules/.pnpm/undici@5.11.0/node_modules/undici/lib/fetch/response.js (evalmachine.<anonymous>:6510:49)
      at __require (evalmachine.<anonymous>:14:50)
      at <unknown> (evalmachine.<anonymous>:11635:30)
      at requireFn (file://R:\work\_tmp\video-api-tiktok\node_modules\next\dist\compiled\edge-runtime\index.js:1:7079) {
    middleware: true
  }

Error disappears after upgrading the Node.js to v14.18.0

Does the docs page already exist? Please link to it.

https://nextjs.org/docs

@Amasoken Amasoken added the Documentation Related to Next.js' official documentation. label Nov 10, 2022
@balazsorban44
Copy link
Member

Hi, this rather seems like a bug, introduced in #41987.

@balazsorban44 balazsorban44 added kind: bug Confirmed bug that is on the backlog Runtime Related to Node.js or Edge Runtime with Next.js. Upstream Related to using Next.js with a third-party dependency. (e.g., React, UI/icon libraries, etc.). and removed Documentation Related to Next.js' official documentation. labels Nov 10, 2022
@bayram00
Copy link

@Amasoken i faced the same problem and i solved it thanks

styfle added a commit that referenced this issue Apr 19, 2023
fixes #42729

According to #42729, the minimum Node.js version of Next is `14.18.0`,
but some docs say `14.6.0`, and it's error-prone.
#42729 (comment)
pointed out it's a bug rather than wrong documentation.

But Node v14 is going to be EOF this month, so Next will update the
minimum version in the next major release.
https://github.com/nodejs/release#release-schedule

So I feel it's enough to only fix the documentation rather than fixing
the implementation to work with 14.6.0 as a temporary fix.


<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation or adding/fixing Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md



## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->

---------

Co-authored-by: Steven <steven@ceriously.com>
@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind: bug Confirmed bug that is on the backlog Runtime Related to Node.js or Edge Runtime with Next.js. Upstream Related to using Next.js with a third-party dependency. (e.g., React, UI/icon libraries, etc.).
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
@balazsorban44 @Amasoken @bayram00 and others