Skip to main content
Version: 10.x

卸载 pnpm

删除全局安装的软件包

🌐 Removing the globally installed packages

在删除 pnpm CLI 之前,删除 pnpm 安装的所有全局包可能是有意义的。

🌐 Before removing the pnpm CLI, it might make sense to remove all global packages that were installed by pnpm.

要列出所有全局包,请运行 pnpm ls -g。有两种方法可以删除全局包:

🌐 To list all the global packages, run pnpm ls -g. There are two ways to remove the global packages:

  1. 对列出的每个全局包运行 pnpm rm -g <pkg>...
  2. 运行 pnpm root -g 以查找全局目录的位置并手动删除它。

删除 pnpm CLI

🌐 Removing the pnpm CLI

如果你使用独立脚本安装 pnpm,那么你应该能够通过删除 pnpm 主目录来卸载 pnpm CLI:

🌐 If you used the standalone script to install pnpm, then you should be able to uninstall the pnpm CLI by removing the pnpm home directory:

rm -rf "$PNPM_HOME"

你可能还想清理你在 shell 配置文件($HOME/.bashrc$HOME/.zshrc$HOME/.config/fish/config.fish)中的 PNPM_HOME 环境变量。

🌐 You might also want to clean the PNPM_HOME env variable in your shell configuration file ($HOME/.bashrc, $HOME/.zshrc or $HOME/.config/fish/config.fish).

如果你使用 npm 安装 pnpm,那么你应该使用 npm 卸载 pnpm:

🌐 If you used npm to install pnpm, then you should use npm to uninstall pnpm:

npm rm -g pnpm

删除全局内容可寻址存储

🌐 Removing the global content-addressable store

rm -rf "$(pnpm store path)"

如果你在非主磁盘上使用了 pnpm,那么你必须在每个使用过 pnpm 的磁盘上运行上述命令。pnpm 会为每个磁盘创建一个存储库。

🌐 If you used pnpm in non-primary disks, then you must run the above command in every disk, where pnpm was used. pnpm creates one store per disk.