---
title: "Non-Standard `NODE_ENV`"
url: "https://nextjs.org/docs/messages/non-standard-node-env"
docs_index: /docs/llms.txt
---



## Why This Error Occurred

Your environment has a non-standard `NODE_ENV` value configured.

This may be by accident, so if you're unaware where the value is coming from, check the following:

- The `.env*` files in your project, if present
- Your `~/.bash_profile`, if present
- Your `~/.zshrc`, if present

The greater React ecosystem treats `NODE_ENV` as a convention, only permitting three (3) values:

- `production`: When your application is built with `next build`
- `development`: When your application is run with `next dev`
- `test`: When your application is being tested (e.g. `jest`)

Setting a non-standard `NODE_ENV` value may cause dependencies to behave unexpectedly, or worse, **break dead code elimination**.

### `NODE_ENV` during `next build`

`next build` creates a production build by default: the compiled code assumes `NODE_ENV=production`, so the code that runs during the build (for example, while prerendering pages) must agree with it. If `NODE_ENV` is set to `development` when you run `next build`, the build fails before compiling. Other non-standard values only show the warning above.

To fix it, remove `NODE_ENV` from the environment that runs `next build` (for example your shell profile, Dockerfile or CI settings). A `NODE_ENV` value in `.env*` files doesn't cause this error, because Next.js sets `NODE_ENV` before it loads those files. Next.js sets the correct value for you.

If you intentionally want a development build, enable `experimental.allowDevelopmentBuild` in `next.config.js` and set `NODE_ENV=development` explicitly. Next.js then compiles development code, so the build stays consistent and can prerender pages. `next build --debug-prerender` enables this option for you, to help debug errors thrown while prerendering your own pages.

## Possible Ways to Fix It

To fix this error, identify the source of the erroneous `NODE_ENV` value and get rid of it: Next.js automatically sets the correct value for you.

If you need the concept of different environments in your application, e.g. `staging`, you should use a different environment variable name like `APP_ENV`.

## Useful Links

- [Environment Variables](https://en.wikipedia.org/wiki/Environment_variable)
