執行環境套件管理器打包器測試執行器程式碼檢查格式化指南參考部落格意見回饋

bun remove

從你的專案中移除相依

基本用法

terminal
bun remove ts-node

Bun 會從 package.json 中列出的每個相依組中移除該軟體包,並更新 bun.lock。當沒有其他內容相依該軟體包後,Bun 會將其從 node_modules 中刪除。

--filter

在單體儲存庫中,使用與 bun add --filter 相同的模式,將軟體包從匹配的工作區中移除,而不是從當前目錄的軟體包中移除。使用 --filter '*' 可將其從每個工作區軟體包中移除。不包含該軟體包的工作區不會受到影響。

terminal
bun remove zod --filter api
bun remove zod --filter '*'

CLI 用法

terminal
bun remove <package>

一般資訊

--helpboolean

顯示此幫助選單。別名:-h

設定

--configstring

指定設定檔路徑(bunfig.toml)。別名:-c

Package.json 互動

--no-saveboolean

不更新 package.json 或儲存鎖檔案

--savebooleandefault true

儲存到 package.json(預設啟用)

--trustboolean

新增到專案 package.json 中的 trustedDependencies 並安裝該包

--filterstring

從匹配的工作區中移除軟體包,而不是從當前軟體包中移除。別名:-F

鎖檔案行為

--yarnboolean

寫入 yarn.lock 檔案(yarn v1)。別名:-y

--frozen-lockfileboolean

不允許修改鎖檔案

--save-text-lockfileboolean

儲存基於文本的鎖檔案

--lockfile-onlyboolean

僅生成鎖檔案,不安裝相依

相依過濾

--productionboolean

不安裝 devDependencies。別名:-p

--omitstring

從安裝中排除 dev、optional 或 peer 相依

網路與登錄檔

--castring

提供證書頒發機構簽名證書

--cafilestring

與 --ca 相同,但作為證書的檔案路徑

--registrystring

預設使用指定的登錄檔,覆蓋 .npmrc、bunfig.toml 和環境變數

執行控制與驗證

--dry-runboolean

解析此更改,但不移除軟體包、不更新 package.json 或儲存鎖檔案(專案自身的生命週期指令碼仍會執行)

--forceboolean

總是請求最新版本並重新安裝所有相依。別名:-f

--no-verifyboolean

跳過驗證新下載包的完整性

輸出與日誌

--silentboolean

不輸出任何日誌

--verboseboolean

過度詳細的日誌

--no-progressboolean

停用進度條

--no-summaryboolean

不列印摘要

快取

--cache-dirstring

將快取資料儲存及讀取至指定目錄路徑

--no-cacheboolean

完全忽略清單快取

指令碼執行

--ignore-scriptsboolean

跳過所有軟體包的生命週期指令碼,包括專案的 package.json 和受信任的相依項

--concurrent-scriptsnumber

生命週期指令碼的最大並行任務數(預設:CPU 核心數的 2 倍)

作用域與路徑

--globalboolean

全域性安裝。別名:-g

--cwdstring

設定特定的當前工作目錄

高階與效能

--backendstring

安裝相依項的平臺特定最佳化。可能的值:clonefile(macOS 上的預設值)、hardlink(Linux 和 Windows 上的預設值)、symlink、copyfile

--network-concurrencynumberdefault 48

最大並行網路請求數(預設 48)