Uninstalling Yarn depends on how you installed it. Below are different methods based on your installation type.
Uninstalling Yarn Based on Installation Method
1. If Installed via npm
If you installed Yarn using npm, you can remove it with:
npm uninstall -g yarn
- This removes Yarn globally from your system.
To confirm it’s uninstalled, run:
yarn --version
If the command is not found, it’s successfully removed.
2. If Installed via Homebrew (macOS/Linux)
For macOS and Linux users who installed Yarn via Homebrew, use:
brew uninstall yarn
If you want to remove all dependencies, run:
brew cleanup
3. If Installed via Chocolatey (Windows)
For Windows users who installed Yarn using Chocolatey, remove it with:
choco uninstall yarn
4. If Installed via the Yarn Installer
If you installed Yarn via the standalone installer:
- Manually delete Yarn from your system’s installation directory (usually in C:Program Files (x86)Yarn on Windows or /usr/local/bin/yarn on Linux/macOS).
Final Checks
After uninstallation, verify it's removed by running:
yarn --version
If you get an error like "command not found," Yarn is successfully uninstalled.