Skip to main content
Version: 9.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>... 并列出每个全局包。

    ¥Run pnpm rm -g <pkg>... with each global package listed.

  2. 运行 pnpm root -g 查找全局目录的位置并手动将其删除。

    ¥Run pnpm root -g to find the location of the global directory and remove it manually.

删除 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 配置文件中的 PNPM_HOME 环境变量($HOME/.bashrc$HOME/.zshrc$HOME/.config/fish/config.fish)。

¥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.