← 返回命令列表

Linux command

npm-query 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Query dependencies

npm query "[name=lodash]"

Find dev dependencies

npm query ":type(dev)"

Find outdated

npm query ":outdated(major)"

Find vulnerabilities

npm query ":vuln"

Complex query

npm query "[name^=@babel]"

说明

npm query queries dependency graph with selectors. CSS-like syntax for packages. The command filters dependencies. Powerful package searching.

参数

--global
Query the globally-installed tree instead of the project.
--workspace _NAME_
Restrict the query to the given workspace(s).
--workspaces
Apply across every workspace.
--include-workspace-root
Include the workspace root package in the results.
--package-lock-only
Read from `package-lock.json` only, do not touch `node_modules`.
--expect-result-count _N_, --expect-results _BOOL_
Make npm exit non-zero if the result count does not match.
--help
Display help information.

FAQ

What is the npm-query command used for?

npm query queries dependency graph with selectors. CSS-like syntax for packages. The command filters dependencies. Powerful package searching.

How do I run a basic npm-query example?

Run `npm query "[name=lodash]"` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --global do in npm-query?

Query the globally-installed tree instead of the project.