npm-bugs
Open a package's issue tracker
TLDR
Report bugs for a specific package by opening the bug tracker for the specified package
Open the bug tracker for the current package by searching for a package.json file and using its name
Configure the browser used to open URLs by setting your preferred browser for npm commands
Control URL opening: set browser to true for the system URL opener, or false to print URLs in the terminal
SYNOPSIS
npm bugs [package-spec]
PARAMETERS
[package-spec]
An optional identifier for the package whose bug tracker URL should be opened. This can be a package name (e.g., react), a package name with a version or tag (e.g., lodash@4, vue@next), or a path to a package directory. If omitted, npm bugs defaults to the package in the current working directory.
--json
Outputs the bug tracker URL in JSON format to standard output instead of opening it in a web browser. This is useful for programmatic access or scripting.
--registry url
Specifies the base URL of the npm registry to use when resolving package information.
--workspace name
Executes the command within a specific workspace. Applicable when working with npm workspaces (monorepos).
--workspaces
Runs the command for all configured workspaces within the current project, opening a bug tracker for each. Excludes the root project unless --include-workspace-root is also specified.
--include-workspace-root
When used with --workspaces, ensures that the root project's bug tracker is also considered and opened.
DESCRIPTION
The npm bugs command is a utility within the Node Package Manager (npm) that allows users to quickly access the bug tracker or issue reporting page associated with a specific package.
When invoked without a package name, it attempts to open the bug tracker for the package in the current working directory, inferring the package from the package.json file. If a package-spec (e.g., package@version) is provided, npm bugs will look up that package in the npm registry and retrieve its bug tracker URL. This URL is typically found in the bugs field of the package's package.json metadata.
The command then attempts to open this URL using your system's default web browser. This streamlines the process of reporting issues or checking known bugs for dependencies or your own projects, without manually searching for the bug tracker link. It's a convenient shortcut for developers and users to engage with package maintainers regarding defects or feature requests.
CAVEATS
The command relies on the bugs field being present and correctly configured in the package's package.json file or its metadata in the npm registry. If this field is missing or malformed, npm bugs may fail to open a URL or open an incorrect one.
It requires a graphical environment and a default web browser configured on the system to open the URL automatically. In headless environments, the --json option should be used to retrieve the URL programmatically.
DEFAULT BROWSER
npm bugs uses the system's default command for opening URLs (e.g., xdg-open on Linux, open on macOS, start on Windows). Ensure your system is configured to open URLs with your preferred web browser.
NO URL FOUND
If a package's package.json or registry metadata does not contain a bugs field, or if the field is empty, npm bugs will report an error indicating that no bug tracker URL could be found for the specified package.
HISTORY
npm bugs is an integral part of the npm CLI, which was first released in January 2010. Its inclusion reflects the npm project's goal of simplifying common developer workflows, such as quickly accessing package resources like documentation, repositories, and bug trackers. As npm evolved into the dominant package manager for Node.js, commands like npm bugs became standard utilities, providing immediate access to community support and issue reporting mechanisms, contributing to the health and maintainability of the vast npm ecosystem.