pnpm setup
Installs the running pnpm into PNPM_HOME and adds it to PATH. The standalone installation scripts of pnpm run this command, for instance https://get.pnpm.io/install.sh.
pnpm setup [--force] [--no-modify-path]
安装程序执行以下操作:
- 为 pnpm CLI 创建一个主目录
- 通过更新 shell 配置文件将 pnpm 主目录添加到
PATH - installs the running pnpm executable as a global package
- writes the
pn,pnpx, andpnxscripts to$PNPM_HOME/bin, the directory of globally installed binaries
To make a runtime command project-aware after setup, see pnpm shim.
If pnpm setup cannot tell which shell configuration file to update, for example
in a container where SHELL is not set, it still installs pnpm. It then prints the
PNPM_HOME and PATH lines to add to your shell configuration yourself.
On Windows, if the registry environment values cannot be read or written,
pnpm setup still installs pnpm. It prints commands to set PNPM_HOME and
PATH in the current PowerShell session. 将这些命令添加到你的 PowerShell
配置文件中,以便在未来的会话中无需访问注册源即可使用 pnpm。
When running on GitHub Actions, pnpm setup also appends PNPM_HOME and the global bin directory to the GitHub Actions environment files (GITHUB_ENV and GITHUB_PATH), so later steps in the same job can run pnpm add --global and other global commands.
配置项#
--force, -f#
Override the PNPM_HOME environment variable if it already exists.
--no-modify-path#
Install pnpm without adding it to PATH. shell 配置文件、Windows 注册表和 GitHub Actions 环境文件均保持不变。 pnpm setup prints the PNPM_HOME and PATH lines to add yourself.
当你自行管理 shell 配置,或者 pnpm 是为没有登录 shell 的用户安装的(例如在容器镜像中)时,请使用此选项。