How to view the dependency tree of a given npm module?

后端 未结 10 1653
眼角桃花
眼角桃花 2020-12-22 16:40

How can I get the tree of a module available to npm, but not installed locally ?

npm ll does the job for locally installed packages. But it doesn\'t wor

10条回答
  •  被撕碎了的回忆
    2020-12-22 17:18

    You can generate NPM dependency trees without the need of installing a dependency by using the command

    npm list
    

    This will generate a dependency tree for the project at the current directory and print it to the console.

    You can get the dependency tree of a specific dependency like so:

    npm list [dependency]
    

    You can also set the maximum depth level by doing

    npm list --depth=[depth]
    

    Note that you can only view the dependency tree of a dependency that you have installed either globally, or locally to the NPM project.

提交回复
热议问题