pnpmをアンインストールする

グローバルにインストールしたパッケージを削除する#

pnpm CLIを削除する前に、pnpmによってインストールされたすべてのグローバルパッケージを削除するほうがよいでしょう。

To list all the global packages, run pnpm ls -g. グローバルパッケージを削除する方法は2つあります。

  1. Run pnpm rm -g <pkg>... with each global package listed.
  2. Run pnpm root -g to find the location of the global directory and remove it manually.

pnpmコマンドを削除する#

スタンドアロンスクリプトを使用してpnpmをインストールした場合、pnpmのホームディレクトリを削除することで、pnpm CLIをアンインストールできるはずです。

rm -rf "$PNPM_HOME"

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

npmでpnpmをインストールした場合、次のように実行するとpnpmをアンインストールできます。

npm rm -g pnpm

参照可能なグローバルコンテンツストアを削除する#

rm -rf "$(pnpm store path)"

プライマリ以外のディスクで pnpm を使用した場合は、pnpm を使用したすべてのディスクで上記のコマンドを実行する必要があります。 pnpmは1つのディスクに1つのストアを作成します。 On a disk other than the one with the pnpm home directory, the store is a .pnpm-store directory near the root of the disk, or node_modules/.pnpm-store inside the project.

Removing the cache, state, and configuration#

pnpm also writes to these directories. Remove them too:

  • the cache directory, see cacheDir for its default location
  • the state directory, see stateDir for its default location
  • the directory of the global configuration file, see Global configuration