Node.js/npm/版本号码:修订间差异

来自康健生活
Kangkk​(留言 | 贡献)
Kangkk​(留言 | 贡献)
第74行: 第74行:


=== jq ===
=== jq ===
{{shc|<syntaxhighlight lang="bash">
npm -j ls <pkg> | jq -r .version
npm --json list <pkg> | jq --raw-output '.version'
</syntaxhighlight>|$|/home/kwy}}
全局
{{shc|<syntaxhighlight lang="bash">
npm -j -g ls | jq -r .dependencies.<pkg>.version
</syntaxhighlight>|$|/home/kwy}}
=== npm ===
{{shc|<syntaxhighlight lang="bash">
npm ls <pkg>
#
npm list <pkg></syntaxhighlight>|$|/home/kwy}}
如果是在 monorepo 模式下会变得繁琐
{{Shc_out|<syntaxhighlight lang="bash">
npm ls @postlab/component-rest --no-workspaces</syntaxhighlight>|<syntaxhighlight lang="bash">
@postlab/common@2025.4.0 /home/kwy/postlab-vip/packages/postlab-common
└── @postlab/component-rest@0.0.7 -> ./../../node_modules/.pnpm/@postlab+component-rest@0.0.7_@lezer+common@1.2.1_eslint@8.57.0_graphql@16.9.0_openapi-_4baa08fda89e43a02ac08d9dc46c167c/node_modules/@postlab/component-rest
</syntaxhighlight>|$|/home/kwy}}