npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

pm-detect

v0.4.0

Published

A CLI tool to detect the node package manager used in a project

Readme

Package Manager Detect

All Contributors

This package includes a bin which can be used to detect the current node package manager a node project uses and it's associated commands.

Usage

No need to install, can be run via node exec commands such as:

npx pm-detect

The above command will log the following JSON blob to stdout (if the project uses NPM):

{
  "name": "npm",
  "install": "npm install",
  "frozen-install": "npm ci",
  "global-install": "npm install -g",
  "run": "npm run",
  "exec": "npx"
}

The structure of the output is always the same regardless of package manager (NPM, yarn, PNPM). It is only the values of the object that change.

Command Line Options

The pm-detect CLI supports the following options:

--working-dir <path>

Specifies the working directory to detect the package manager in. If not provided, the current working directory is used.

npx pm-detect --working-dir /path/to/project

[!NOTE] If no package manager is detected in the working directory the cli will traverse up the directory tree until it finds one. This should prove useful in monorepos where a workspace might be passed as the current working directory.

--strategies <strategies>

Specifies a comma-separated list of detection strategies to use. Available strategies are:

  • packageJson - Detect from package.json's packageManager field (recommended)
  • lockFile - Detect from lock file presence (package-lock.json, yarn.lock, pnpm-lock.yaml)
  • userAgent - Detect from npm_config_user_agent environment variable
# Use only package.json detection
npx pm-detect --strategies packageJson

# Use multiple strategies in a specific order
npx pm-detect --strategies packageJson,lockFile,userAgent

--help

Shows the help message with all available options.

npx pm-detect --help

--version

Shows the current version of the CLI tool.

npx pm-detect --version

Examples

# Basic usage - detects package manager in current directory
npx pm-detect

# Detect in a specific directory
npx pm-detect --working-dir /path/to/project

# Use only lock file detection strategy
npx pm-detect --strategies lockFile

# Combine options
npx pm-detect --working-dir /path/to/project --strategies packageJson,lockFile

Thanks

This project is based heavily on the following npm packages. Many thanks to their authors.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

Security

This package is published using NPMs provenence feature that asserts a given release is tied to a specific commit.