Skip to content

process.env is missing environment variables with numeric names #60795

@dpaoliello

Description

@dpaoliello

Version

25.2.1, 24.11.1

Platform

Windows 11: Microsoft Windows NT 10.0.28000.0 x64
Ubuntu 24: Linux 6.6.87.1-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC Mon Apr 21 17:08:54 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

  1. Set an environment variable with a numeric name.
  2. Run node.
  3. Check in process.env for that environment variable.

For example, in a Windows Command Prompt:

echo console.log(process.env['386']);console.log(process.env['OTHER']); > test.js
set 386=1
set OTHER=1
node test.js

Produces:

undefined
1

I'm not 100% sure how to set such env vars in bash, but it does repro using PowerShell in Ubuntu:

PS> $env:OTHER=1
PS> $env:386=1
PS> node test.js
undefined
1

How often does it reproduce? Is there a required condition?

100% repro.

What is the expected behavior? Why is that the expected behavior?

The environment variable should be present in process.env - a numeric name is valid and can be set once in Node.

What do you see instead?

The environment variable is missing.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    processIssues and PRs related to the process subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions