Skip to content

[BUG] npm run -- <args> not working #3336

Closed
@v1d3rm3

Description

@v1d3rm3

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When i have a script definition, like test in package.json, when i try to execute this command with arguments, npm is interpreting as a npm cli argument.

Ex:
npm run test -- -h

Gives-me:

npm run-script

Run arbitrary package scripts

Usage:
npm run-script <command> [-- <args>]

Options:
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--if-present] [--ignore-scripts]
[--script-shell <script-shell>]

aliases: run, rum, urn

Run "npm help run-script" for more info

Expected Behavior

I expect that when i run npm run test -- -h, it gives me jest help info.

Steps To Reproduce

  1. NodeJs v16.2, npm v7.15.0
  2. A simple package with Jest as dependency and a script definition: "test": "jest"
  3. Run npm run test -- -h
  4. Not showing jest info

Environment

  • OS: Windows 10
  • Node: 16.2.0
  • npm: 7.15.0

Activity

added
Bugthing that needs fixing
Needs Triageneeds review for next steps
Release 7.xwork is associated with a specific npm 7 release
on May 30, 2021
bruxisma

bruxisma commented on Jun 2, 2021

@bruxisma

I'm also experiencing this same issue, using:

  • Powershell 7.1.3
  • Windows Terminal 1.7.1033
  • Node LTS 14.17.0
  • npm 7.15.0
  • Windows 10
gregoryzh

gregoryzh commented on Jun 3, 2021

@gregoryzh

reported here too.
#3136
it's only powershell, bash or cmd works

v1d3rm3

v1d3rm3 commented on Jun 8, 2021

@v1d3rm3
Author

I have used powershell too, so it's the problem.

wraithgar

wraithgar commented on Jul 1, 2021

@wraithgar
Member

Closing in favor of #3136

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

    Bugthing that needs fixingNeeds Triageneeds review for next stepsRelease 7.xwork is associated with a specific npm 7 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @wraithgar@bruxisma@v1d3rm3@gregoryzh

        Issue actions

          [BUG] npm run -- <args> not working · Issue #3336 · npm/cli