npm-help
Show npm command help
TLDR
Display the documentation for a specific command
SYNOPSIS
npm help <term>
npm <command> --help
npm help-search <text>
PARAMETERS
<term>
The specific npm command (e.g., install, publish) or conceptual topic (e.g., package.json, folders) for which to display help. If omitted, it lists all available npm commands.
<command> --help
An alternative, equivalent way to request help for a specific npm command, appended directly to the command itself.
<text>
Used with npm help-search to perform a fuzzy search across all npm documentation for pages containing the specified text.
--viewer=<viewer>
Specifies an alternative program to use as a man page viewer instead of the default (typically man or less).
--no-markdown
Displays the raw markdown source of the help page, bypassing rendering by the viewer.
DESCRIPTION
The npm help command serves as the primary gateway to npm's extensive built-in documentation system. It provides detailed information on all npm commands, configurations, and various conceptual topics.
When invoked, npm help either displays a specific manual page (similar to man pages) for a given command or topic, or it can be used to search across all available documentation. It is designed to be the first point of reference for users seeking to understand how to use different npm features, their syntax, options, and examples.
This command is crucial for developers working with Node.js and npm, offering quick access to context-sensitive information directly within the terminal, without needing an internet connection (once npm is installed). It leverages markdown files distributed with npm itself, often rendered through a system pager like less or man.
CAVEATS
The effectiveness of npm help relies on the installation of a compatible man page viewer (like less) on the system. Without one, the output might be less readable. Search results from npm help-search can sometimes be broad or require refinement to find the most relevant documentation.
HOW IT WORKS
When you run npm help, npm locates the relevant markdown file (e.g., npm-install.md for npm help install) within its installation directory. This markdown content is then typically piped to a system pager program, usually man or less, which renders it into a readable, formatted text within your terminal. This process ensures consistent formatting and navigation familiar to Linux man page users.
LISTING ALL COMMANDS
Invoking npm help without any arguments (or just npm --help) displays a comprehensive list of all top-level npm commands, categorized by their primary function. This provides a quick overview of what npm is capable of and serves as a starting point for exploring its features.
HISTORY
npm help has been an integral part of the npm client since its inception, evolving alongside the npm ecosystem. Its development mirrors the growth of Node.js, providing readily accessible documentation for an expanding set of commands and features. From early versions, it aimed to consolidate all necessary usage information directly within the tool, making it self-documenting and reducing reliance on external web resources for basic command usage. Its core functionality of rendering markdown files as man pages has remained consistent, ensuring a familiar and efficient user experience.
SEE ALSO
npm(1), npm-install(1), npm-config(1), man(1), less(1)


