unjs / unjs/std-env

NODE_ENV not being picked

Open
#174 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
641
Forks
41
PR merge metrics
No merged PRs in 30d

Description

Environment

Node v20/v22 LTS
Windows 10
pnpm v10

Reproduction
import { defineNuxtConfig } from 'nuxt/config';
import { isDevelopment, nodeENV } from 'std-env';

console.log(process.env.NODE_ENV, { isDevelopment, nodeENV });

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  compatibilityDate: '2025-08-15',
  devtools: { enabled: true },
});

Running pnpm dev

Describe the bug

Likely not a bug with the package, but I'm trying to investigate.

nodeENV returns an empty string, and isDevelopment is false, despite process.env.NODE_ENV being development. Could you possibly give me pointers on what may be causing my environment to have this? I am happy to investigate myself and report back + close issue.

Additional context

No response

Logs

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided Nuxt configuration reproduction and run pnpm dev on the stated Node and Windows environment, comparing process.env.NODE_ENV with nodeENV and isDevelopment. Trace the environment values exposed by std-env and document the cause or a reproducible fix, with regression coverage if the repository has a relevant test entry point.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, nuxtjs, typescript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.