[英]npm: How to extract dependencies?
Using pip one can do: 使用pip可以做到:
pip freeze > requirements.txt
This extracts all dependencies. 这将提取所有依赖项。 Is there something similar for npm?
npm有类似的东西吗?
You can do npm init
which will generate a package.json
that includes the modules in your node_modules
subdirectory. 您可以执行
npm init
来生成package.json
,其中将在node_modules
子目录中包含模块。
If you don't need/want to generate a package.json
, you could get the dependency tree via npm ls
. 如果不需要/不想生成
package.json
,则可以通过npm ls
获得依赖树。 You can adjust the depth to include only direct dependencies via npm ls --depth=0
. 您可以通过
npm ls --depth=0
调整深度,使其仅包含直接依赖关系。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.