选择命令行版本:
🌐 Synopsis
npm ll [[<@scope>/]<pkg> ...]alias: la
🌐 Description
列出已安装的包
🌐 List installed packages
🌐 Configuration
all在运行 npm outdated 和 npm ls 时,设置 --all 将显示所有过时或已安装的软件包,而不仅仅是当前项目直接依赖的那些包。
🌐 When running npm outdated and npm ls, setting --all will show all outdated or installed packages, rather than only those directly depended upon by the current project.
json是否输出 JSON 数据,而不是正常输出。
🌐 Whether or not to output JSON data, rather than the normal output.
npm pkg set 中,它可以在将值保存到你的 package.json 之前使用 JSON.parse() 解析设置的值。并非所有 npm 命令都支持。
🌐 Not supported by all npm commands.
long在 ls、search 和 help-search 中显示扩展信息。
🌐 Show extended information in ls, search, and help-search.
parseable从写入标准输出的命令中输出可解析的结果。对于 npm search,这将是制表符分隔的表格格式。
🌐 Output parseable results from commands that write to standard output. For npm search, this will be tab-separated table format.
global以“全局”模式运行,因此软件包会安装到 prefix 文件夹中,而不是当前工作目录。有关行为差异的更多信息,请参见 folders。
🌐 Operates in "global" mode, so that packages are installed into the prefix folder instead of the current working directory. See folders for more on the differences in behavior.
{prefix}/lib/node_modules 文件夹中,而不是当前工作目录。{prefix}/bin 关联{prefix}/share/mandepth--all,则为 Infinity;否则为 0在递归 npm ls 包时要达到的深度。
🌐 The depth to go when recursing packages for npm ls.
如果未设置,npm ls 只会显示根项目的直接依赖。如果设置了 --all,则 npm 默认会显示所有依赖。
🌐 If not set, npm ls will show only the immediate dependencies of the root project. If --all is set, then npm will show all dependencies by default.
omitNODE_ENV 环境变量被设置为 'production',则为 'dev';否则为空。要从磁盘上的安装树中省略的依赖类型。
🌐 Dependency types to omit from the installation tree on disk.
请注意,这些依赖仍然会被解析并添加到 package-lock.json 或 npm-shrinkwrap.json 文件中。它们只是没有实际安装到磁盘上。
🌐 Note that these dependencies are still resolved and added to the package-lock.json or npm-shrinkwrap.json file. They are just not physically installed on disk.
如果某种封装类型同时出现在 --include 和 --omit 列表中,那么它将被包括在内。
🌐 If a package type appears in both the --include and --omit lists, then it will be included.
如果生成的省略列表包含 'dev',那么所有生命周期脚本的 NODE_ENV 环境变量将被设置为 'production'。
🌐 If the resulting omit list includes 'dev', then the NODE_ENV environment variable will be set to 'production' for all lifecycle scripts.
include允许定义要安装的依赖类型的选项。
🌐 Option that allows for defining which types of dependencies to install.
这是 --omit=<type> 的逆。
🌐 This is the inverse of --omit=<type>.
在 --include 中指定的依赖类型不会被忽略,无论命令行中 omit/include 的顺序如何。
🌐 Dependency types specified in --include will not be omitted, regardless of the order in which omit/include are specified on the command-line.
link与 npm ls 一起使用,仅限制输出到那些已链接的包。
🌐 Used with npm ls, limiting output to only those packages that are linked.
package-lock-only如果设置为 true,当前操作将只使用 package-lock.json,忽略 node_modules。
🌐 If set to true, the current operation will only use the package-lock.json, ignoring node_modules.
对于 update,这意味着只会更新 package-lock.json,而不会检查 node_modules 或下载依赖。
🌐 For update this means only the package-lock.json will be updated, instead of checking node_modules and downloading dependencies.
对于 list,这意味着输出将基于 package-lock.json 描述的树,而不是 node_modules 的内容。
🌐 For list this means the output will be based on the tree described by the package-lock.json, rather than the contents of node_modules.
unicodeLC_ALL、LC_CTYPE 或 LANG 环境变量定义。当设置为 true 时,npm 在树状输出中使用 Unicode 字符。当设置为 false 时,它使用 ASCII 字符而不是 Unicode 字符。
🌐 When set to true, npm uses unicode characters in the tree output. When false, it uses ascii characters instead of unicode glyphs.
workspace启用在当前项目的已配置工作区的上下文中运行命令,同时通过仅运行此配置选项定义的工作区进行过滤。
🌐 Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option.
workspace 配置的有效值为以下之一:
🌐 Valid values for the workspace config are either:
对于 npm init 命令设置时,可以将其设置为一个尚不存在的工作区文件夹,以创建该文件夹并将其作为项目内全新的工作区进行设置。
🌐 When set for the npm init command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project.
此值不会导出到子进程的环境中。
🌐 This value is not exported to the environment for child processes.
workspaces设置为 true 以在 所有 配置的工作区上下文中运行命令。
🌐 Set to true to run the command in the context of all configured workspaces.
将此显式设置为 false 会导致像 install 这样的命令完全忽略工作区。如果不显式设置:
🌐 Explicitly setting this to false will cause commands like install to ignore workspaces altogether. When not set explicitly:
node_modules 树操作的命令(安装、更新等)会将工作区链接到 node_modules 文件夹。- 执行其他操作的命令(测试、执行、发布等)会在根项目上运行,除非 在 workspace 配置中指定了一个或多个工作区。此值不会导出到子进程的环境中。
🌐 This value is not exported to the environment for child processes.
include-workspace-root为命令启用工作区时包括工作区根。
🌐 Include the workspace root when workspaces are enabled for a command.
当为 false 时,通过 workspace 配置指定单个工作区,或通过 workspaces 标志指定所有工作区,将导致 npm 仅在指定的工作区上操作,而不会在根项目上操作。
🌐 When false, specifying individual workspaces via the workspace config, or all workspaces via the workspaces flag, will cause npm to operate only on the specified workspaces, and not on the root project.
此值不会导出到子进程的环境中。
🌐 This value is not exported to the environment for child processes.
install-links当设置文件时:协议依赖将作为常规依赖被打包和安装,而不会创建符号链接。此选项对工作区没有影响。
🌐 When set file: protocol dependencies will be packed and installed as regular dependencies instead of creating a symlink. This option has no effect on workspaces.
🌐 See Also