← 返回命令列表

Linux command

bun-pm-trust 命令

文本

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

常用示例

Run blocked lifecycle scripts

bun pm trust [package1] [package2]

Trust all

bun pm trust --all

List

bun pm untrusted

Install

bun add --trust [package]

说明

bun pm trust runs blocked lifecycle scripts (such as postinstall, preinstall, and node-gyp builds) for specified untrusted dependencies and adds those packages to the trustedDependencies array in package.json. Unlike npm, Bun blocks arbitrary lifecycle script execution for installed dependencies by default as a security measure. When Bun blocks a script, it installs the package but silently skips its lifecycle scripts. The bun pm trust command is the mechanism for explicitly opting in to running those scripts for packages you have reviewed and trust. Bun maintains a default allowlist of popular packages known to have safe postinstall scripts. This default list only applies to packages sourced from npm; packages from file:, link:, git:, or github: sources require explicit trustedDependencies entries.

参数

--all
Trust all currently untrusted dependencies at once, running all their blocked lifecycle scripts and adding them to trustedDependencies in package.json

FAQ

What is the bun-pm-trust command used for?

bun pm trust runs blocked lifecycle scripts (such as postinstall, preinstall, and node-gyp builds) for specified untrusted dependencies and adds those packages to the trustedDependencies array in package.json. Unlike npm, Bun blocks arbitrary lifecycle script execution for installed dependencies by default as a security measure. When Bun blocks a script, it installs the package but silently skips its lifecycle scripts. The bun pm trust command is the mechanism for explicitly opting in to running those scripts for packages you have reviewed and trust. Bun maintains a default allowlist of popular packages known to have safe postinstall scripts. This default list only applies to packages sourced from npm; packages from file:, link:, git:, or github: sources require explicit trustedDependencies entries.

How do I run a basic bun-pm-trust example?

Run `bun pm trust [package1] [package2]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --all do in bun-pm-trust?

Trust all currently untrusted dependencies at once, running all their blocked lifecycle scripts and adding them to trustedDependencies in package.json