[英]list all globally installed modules with one command in ubuntu
我正在开发ubuntu 14.04
,有没有办法将所有全局模块(使用npm
安装)打印到命令行。 我怎样才能做到这一点?
以下命令将列出您在 Linux、Mac 和 Windows 上全局安装的所有模块。
npm ls -g --depth 0
要列出所有全局安装的模块,请运行:
npm ls -g --depth 0
或纱线
yarn global ls --depth 0
附加功能:
要获得简短的模块描述,请运行:
npm ll -g --depth 0
要查看安装全局模块的路径,请运行:
npm ls -gp --depth 0
我的首选方法是使用npmlist包,它可以使用npm i -g npmlist
安装。 然后,您只需使用npmlist
命令获取所有全局包版本的格式化和颜色列表。
$ npmlist
Installed npm packages: (global)
@vue/cli.................[3.5.1]
browser-sync............[2.26.3]
degit....................[2.1.3]
eslint..................[5.15.3]
eslint-plugin-vue........[5.2.2]
jsonlint.................[1.6.3]
npm......................[6.9.0]
npmlist..................[3.1.2]
prettier................[1.16.4]
serverless..............[1.39.1]
如果您只关心列出包名称而不关心包版本,则命令比所选答案快得多:
ls -l $(npm root -g)
要查看所有全局安装模块的列表,请键入以下命令:
npm ls -g --depth 0
这将为您提供所有已安装模块及其版本的列表。 即使有未满足的依赖项,也将被列出。
以前的全局和本地标志现在已弃用。 今天的首选语法如下:
npm list --location=global --depth 0
npm ls --location=global --depth 0
npm la --location=global --depth 0
npm ll --location=global --depth 0
npmlist=$(npm list --location=global --depth 0)
npmlist
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.