The method for uninstalling Yarn depends on how you initially installed it. Below, I will outline several common uninstallation methods based on different operating systems and installation approaches.
Windows System
If you installed Yarn using the Windows installer, you can uninstall it by following these steps:
- Open Control Panel.
- Click Programs and Features.
- Locate Yarn in the list, click on it, and then select Uninstall.
If you installed Yarn via npm (e.g., using npm install -g yarn), you can uninstall it via the command line:
bashnpm uninstall -g yarn
macOS System
On macOS, if you installed Yarn using Homebrew, you can uninstall it with the following command:
bashbrew uninstall yarn
If you installed Yarn via npm, use:
bashnpm uninstall -g yarn
Linux System
On Linux, the uninstallation method varies depending on the package manager you used. For example:
-
If using APT (e.g., Ubuntu, Debian):
bashsudo apt-get remove yarn -
If using DNF (e.g., Fedora):
bashsudo dnf remove yarn
Verification
After uninstallation, you can run the following command to verify that Yarn has been successfully removed:
bashyarn --version
If the command line displays "command not found" or a similar message, Yarn has been successfully uninstalled.
This covers the methods for uninstalling Yarn based on different operating systems and installation approaches.