# Fix ReferenceError Request Is Not Defined in Next.js

> Install the required Node.js version using nvm or update your deployment settings on Vercel to resolve the Request is not defined error

**URL:** https://sentry.io/answers/next-js-referenceerror-request-is-not-defined-reading-old-version-of-node/

---

## The Problem

When you run your Next.js application locally or when deploying it on a platform like Vercel, you may get the following error:

```
ReferenceError: Request is not defined
```

You may also get a more useful and specific error:

```
You are using Node.js 16.13.1. For Next.js, Node.js version >= v18.17.0 is required.
```

As described in the second error message, this error is caused by not having the required Node.js version. The minimum version depends on your Next.js version: Next.js 15 requires Node.js 18.18.0 or later, and Next.js 16 requires Node.js 20.9 or later.

## The Solution

Install the required [Node.js version](https://nodejs.org/en/download). You can use a tool like [Node Version Manager](https://github.com/nvm-sh/nvm) (nvm) to simplify using different versions of Node on your device. nvm is a command line tool that allows you to quickly install and use different versions of Node. It allows you to use different Node versions for different projects.

To install it follow the [nvm installation guide](https://github.com/nvm-sh/nvm?tab=readme-ov-file#install--update-script). If you use Windows, you can install nvm using WSL (Windows Subsystem for Linux). It should also work with [GitBash](https://gitforwindows.org/) (MSYS) or [Cygwin](https://cygwin.com/).

Once you've installed nvm, you can install a specific version of Node:

```shell
nvm install 22
```

You can then use the `use` command to use a specific Node version:

```shell
nvm use 22
```

Note that you should make sure that your project dependencies work with the new Node version. This may require updating your project's dependencies.

If you are using Vercel to deploy your Next.js application, and you have an issue with the Node.js version, you can change the Node.js version in your Vercel Dashboard [Project Settings](https://vercel.com/docs/functions/runtimes/node-js#setting-the-node.js-version-in-project-settings) under the Node.js Version setting. By default, new projects use the latest Node.js LTS version available on Vercel.

You can define the major `node` version in the `engines` section of your project's `package.json` to override the Vercel dashboard project settings.

To check which Node version your Vercel deployment is using, you can run `node -v` in the build command, or you can log `process.version`.

Make sure that the Node version in your local environment and in your deployed environment match to minimize issues caused by different Node.js versions such as dependencies having different Node.js version requirements.

---

*Source: [sentry.io/answers/next-js-referenceerror-request-is-not-defined-reading-old-version-of-node/](https://sentry.io/answers/next-js-referenceerror-request-is-not-defined-reading-old-version-of-node/)*
