Bun

bun pm

bun pm 指令群組提供了一組用於操作 Bun 套件管理員的工具程式。

若要列印本地專案的 bin 目錄路徑

bun pm bin
/path/to/current/project/node_modules/.bin

若要列印全域 bin 目錄路徑

bun pm bin -g
<$HOME>/.bun/bin

若要列印目前專案中已安裝的相依套件清單及其解析的版本,但不包括其相依套件。

bun pm ls
/path/to/project node_modules (135)
├── eslint@8.38.0
├── react@18.2.0
├── react-dom@18.2.0
├── typescript@5.0.4
└── zod@3.21.4

若要列印所有已安裝的相依套件,包括第 n 階相依套件。

bun pm ls --all
/path/to/project node_modules (135)
├── @eslint-community/eslint-utils@4.4.0
├── @eslint-community/regexpp@4.5.0
├── @eslint/eslintrc@2.0.2
├── @eslint/js@8.38.0
├── @nodelib/fs.scandir@2.1.5
├── @nodelib/fs.stat@2.0.5
├── @nodelib/fs.walk@1.2.8
├── acorn@8.8.2
├── acorn-jsx@5.3.2
├── ajv@6.12.6
├── ansi-regex@5.0.1
├── ...

若要列印 Bun 全域模組快取的路徑

bun pm cache

若要清除 Bun 全域模組快取

bun pm cache rm