Skip to content

util.parseArgs() omits the first positional argument when used with the --eval= option #60808

Description

@kit494way

Version

v25.2.1

Platform

Linux DESKTOP-O26JEMV 6.6.87.2-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC Thu Jun  5 18:30:46 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

node --eval="import {parseArgs} from 'node:util';console.log(parseArgs({allowPositionals: true}))" -- arg1 arg2

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

Always

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

{
  values: [Object: null prototype] {},
  positionals: [ 'arg1', 'arg2' ]
}

What do you see instead?

{ values: [Object: null prototype] {}, positionals: [ 'arg2' ] }

Additional information

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues and PRs for confirmed bugs.utilIssues and PRs related to the built-in util module.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions