</>PackageGraphPackageGraph

which

npmv7.0.0

Like which(1) unix command. Find the first instance of an executable in the PATH.

Safe to adopt

Yes — which scores well across adoption, maintenance, weight, supply chain, and licensing. 290.2M downloads per week and 9 known dependents. Last published 124 days ago. 4 releases in the last 2 years.

  • AAdoption: grade A, Excellent.

    290.2M downloads per week and 9 known dependents.

  • BMaintenance: grade B, Good.

    Last published 124 days ago. 4 releases in the last 2 years.

  • AWeight: grade A, Excellent.

    Pulls in 1 transitive package, about 70 KB installed.

  • ASupply chain: grade A, Excellent.

    No install scripts, 4 maintainers, and a contained dependency surface.

  • ALicense: grade A, Excellent.

    ISC — permissive, with no copyleft found in the dependency tree.

Grades are computed deterministically from registry metadata collected by PackageGraph — downloads, dependents, publish dates, the resolved dependency tree, maintainer count, and declared licenses. No third-party scores are used.

Install cost

What you actually take on by adding which to a project.

1
Direct dependencies

Runtime packages this one declares itself.

1
Total installed

Distinct packages in the full runtime tree, deduplicated the way a package manager would.

70 KB
Install size

Unpacked size of this package plus its entire runtime tree.

1
Tree depth

Longest resolved dependency chain below this package.

Licenses in the dependency tree

BlueOak-1.0.0

Every license you inherit by installing which, not just its own. Check this before a legal review, not after.

Compatibility

Node.js
node ^22.22.2 || ^24.15.0 || >=26.0.0
Module format
CommonJS only
TypeScript
No bundled types
Install scripts
None

Quick start

A usage example from the which README.

javascriptFull README ↗
const which = require('which')

// async usage
// rejects if not found
const resolved = await which('node')

// if nothrow option is used, returns null if not found
const resolvedOrNull = await which('node', { nothrow: true })

// sync usage
// throws if not found
const resolved = which.sync('node')

// if nothrow option is used, returns null if not found
Example truncated — see the full README.

Dependencies

Declared by which v7.0.0. Runtime dependencies are installed with the package; dev dependencies are not.

Runtime (1)

Dev (3)

@npmcli/eslint-config ^6.0.0@npmcli/template-oss 5.0.0tap ^16.3.0

Used by

Popular packages that depend on which.

Relationship graph

Dependencies (left) and dependents (right) of which.

Frequently installed together

Release history

3 releases in the last two years, typically about 92 days apart.

Recent versions of which
VersionPublishedSizeLicense
7.0.0latest4 months ago7.3 KBISC
6.0.17 months ago7.3 KBISC
6.0.010 months ago7.3 KBISC
5.0.01 year ago7.3 KBISC
4.0.03 years ago7.3 KBISC
3.0.13 years ago7.3 KBISC
3.0.03 years ago7.0 KBISC
2.0.26 years ago9.7 KBISC
2.0.17 years ago9.7 KBISC
2.0.07 years ago9.2 KBISC
1.3.18 years ago9.2 KBISC
1.3.09 years agoISC
1.2.149 years agoISC
1.2.139 years agoISC
1.2.129 years agoISC

Overview

which is an npm package that like which(1) unix command. Find the first instance of an executable in the PATH. It is extremely widely used, with about 290.2M downloads per week and 9 known dependents in the graph. The latest version is 7.0.0, released under the ISC license.

Who should use it

Teams working in the npm ecosystem who need like which(1) unix command. Find the first instance of an executable in the PATH and value a battle-tested, widely-adopted solution.

When not to use it

Consider an alternative if you need to have first-class TypeScript types out of the box, or if a more actively-maintained option better fits your npm stack.

Pros

  • Large, well-established user base (290.2M weekly downloads).
  • Clear open-source license (ISC).

Cons

  • No bundled TypeScript types (may require a separate @types package).

Auto-generated from collected registry metadata. No external claims are inferred.

Maintainers

Frequently asked questions

Should I use which?

Yes — which scores well across adoption, maintenance, weight, supply chain, and licensing. 290.2M downloads per week and 9 known dependents. Last published 124 days ago. 4 releases in the last 2 years.

How do I install which?

Run `npm install which` to add which to your npm project.

How many dependencies does which have?

which declares 4 direct dependencies and pulls in 1 packages in total once its runtime tree is resolved totalling about 70 KB on disk.

What license is which released under?

which is distributed under the ISC license.

How popular is which?

which has approximately 290,160,551 downloads per week and 9 known dependent packages.

Is which still maintained?

The most recent release of which (v7.0.0) was published 4 months ago.

Does which run install scripts?

No. which does not define preinstall, install, or postinstall scripts, so installing it does not execute publisher-supplied code.