How do I find all installed packages that depend on a given package in NPM?

node.jsNpm

node.js Problem Overview


I have a npm package that i want to update. I can update my package.json, but I don't want to break something. Is there a way to list all of the installed packages that depend on it?

node.js Solutions


Solution 1 - node.js

You're looking for https://docs.npmjs.com/cli/ls

For example, to see which packages depend on contextify you can run:

npm ls contextify
app-name@0.0.1 /home/zorbash/some-project
└─┬ d3@3.3.6
  └─┬ jsdom@0.5.7
    └── contextify@0.1.15

Solution 2 - node.js

You can use https://www.npmjs.com/package/npm-dependents to find dependents that are not installed.

Update: I see the package is broken, but it still may be a good starting point where the author points out a place where it may be breaking: https://github.com/davidmarkclements/npm-dependents/issues/5#issuecomment-451926479

In the meantime, you may want to just use the "Dependents" tab on the individual npm project pages.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionxdhmooreView Question on Stackoverflow
Solution 1 - node.jsDimitris ZorbasView Answer on Stackoverflow
Solution 2 - node.jsBrett ZamirView Answer on Stackoverflow