Skip to content

[BUG] --location=global does not work from package.json scripts #4945

@ehoogeveen-medweb

Description

@ehoogeveen-medweb

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

I noticed the deprecation warning for --global and changed over to --location=global. However I found that this doesn't work from scripts in package.json. The parameter seems to be silently ignored, whereas --global works and with no deprecation warning. The same thing happens with --location global, -L=global and -L global, all of which work outside package.json scripts.

Expected Behavior

--location=global (and other notations) should work from package.json scripts. I would also expect the deprecation warning to be printed for --global.

Steps To Reproduce

  1. From a fresh npm project (npm init -y).
  2. Set the package.json "test" script to npm install --location=global stylelint.
  3. Run npm run test.
  4. Note that stylelint is installed locally and added as a dependency in package.json.

Environment

  • npm: 8.11.0
  • Node.js: v16.15.0
  • OS Name: Windows 10 (64-bit)

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions