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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20409293/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 16:27:23  来源:igfitidea点击:

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

node.jsnpm

提问by xdhmoore

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?

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?

回答by Dimitris Zorbas

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

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

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

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

npm ls contextify
[email protected] /home/zorbash/some-project
└─┬ [email protected]
  └─┬ [email protected]
    └── [email protected]

回答by Brett Zamir

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

You can use https://www.npmjs.com/package/npm-dependentsto 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

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.

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