Skip to content

Conversation

@MaxBlack-dev
Copy link
Contributor

@MaxBlack-dev MaxBlack-dev commented Nov 30, 2025

Description

This PR adds concrete examples for command line flags, specifically documenting the --prefix\ flag that many users were unable to find in the documentation.

Changes

  • Added a 'Common examples' section under Command Line Flags
  • Documented --prefix\ flag with a clear use case example
  • Included other common flag examples (--global, --save-dev)
  • Added a note explicitly stating that any config option can be used as a command line flag

Fixes

Closes #8197

Context

Users were unable to find documentation for the --prefix\ flag, which is a commonly used option for running npm commands in different directories. While the general mechanism (any config option can be a flag) was explained, there were no concrete examples making it hard to discover. The --prefix\ flag is particularly useful in monorepos and CI/CD scripts where you want to run npm commands in subdirectories without changing the current working directory.

Type of Change

  • Documentation update

@MaxBlack-dev MaxBlack-dev requested a review from a team as a code owner November 30, 2025 01:21
@owlstronaut owlstronaut merged commit 39c2f2e into npm:latest Dec 1, 2025
9 checks passed
@ljharb
Copy link
Contributor

ljharb commented Dec 1, 2025

Note that it's a very bad idea to use --prefix, so it would have been better not to document this at all imo.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DOCS] The --prefix flag is not documented

3 participants