commander
15.1.0 · 7 Nov 2026MIT785.6M / weekRepositoryHomepagenpmAtom feed
12.1.0 is the newest release of 12.x.
In short
7 breaking1 deprecated2 new6 changed
- Breaking
use non-zero exit code when spawned executable subcommand terminates due to a signal
- Breaking
check
passThroughOptionsconstraints when using.addCommandand throw if parent command does not have.enablePositionalOptions()enabled
- Breaking
Commander 12 requires Node.js v18 or higher
- Breaking
throw an error if add an option with a flag which is already in use
- Breaking
throw an error if add a command with name or alias which is already in use
- Breaking
throw error when calling
.storeOptionsAsProperties()after setting an option value
- Breaking
removed default export of a global Command instance from CommonJS (use the named
programexport instead)
- Deprecated
.addHelpCommand()passing string or boolean (use.helpCommand()or pass a Command)
Release note
Added
.addHelpOption()as another way of configuring built-in help option.helpCommand()for configuring built-in help command
Fixed
- Breaking
use non-zero exit code when spawned executable subcommand terminates due to a signal
- Breaking
check
passThroughOptionsconstraints when using.addCommandand throw if parent command does not have.enablePositionalOptions()enabled
Changed
- Breaking
Commander 12 requires Node.js v18 or higher
- Breaking
throw an error if add an option with a flag which is already in use
- Breaking
throw an error if add a command with name or alias which is already in use
- Breaking
throw error when calling
.storeOptionsAsProperties()after setting an option value
Replace non-standard JSDoc of
@api privatewith documented@private.addHelpCommand()now takes a Command (passing string or boolean still works as before but deprecated)Refactor internal implementation of built-in help option
Refactor internal implementation of built-in help command
Deprecated
- Deprecated
.addHelpCommand()passing string or boolean (use.helpCommand()or pass a Command)
Removed
- Breaking
removed default export of a global Command instance from CommonJS (use the named
programexport instead)
Migration Tips
global program
If you are using the deprecated default import of the global Command object, you need to switch to using a named import (or create a new Command).
// const program = require('commander');
const { program } = require('commander');option and command clashes
A couple of configuration problems now throw an error, which will pick up issues in existing programs:
Adding an option which uses the same flag as a previous option
Adding a command which uses the same name or alias as a previous command
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.