The steps to uninstall Yarn vary depending on the operating system. Below are the methods to uninstall Yarn on Windows, macOS, and Linux systems:
Windows System
-
Uninstall via npm (if installed via npm): Open Command Prompt (CMD) or PowerShell, and enter the following command:
bashnpm uninstall --global yarn -
Uninstall via installer: If Yarn was installed via an installer (such as an .exe package), you can uninstall it through 'Add or Remove Programs'. Steps are as follows:
- Open 'Control Panel'.
- Select 'Programs' or 'Programs and Features'.
- Locate Yarn in the program list, click it, and then select 'Uninstall'.
macOS System
-
Uninstall via Homebrew: If you installed Yarn via Homebrew, you can uninstall it using the following command:
bashbrew uninstall yarn -
Uninstall via npm: If installed via npm, run the following command in the terminal:
bashnpm uninstall --global yarn
Linux System
-
Uninstall via package manager: The package manager used varies by Linux distribution. Below are methods to uninstall Yarn on some common distributions:
-
Debian/Ubuntu:
bashsudo apt-get remove yarn -
Fedora:
bashsudo dnf remove yarn -
Arch Linux:
bashsudo pacman -R yarn
-
-
Uninstall via npm: If installed via npm, use the following command:
bashnpm uninstall --global yarn
Clean up environment variables and configuration files
After uninstalling Yarn, you may need to manually clean up environment variables or delete configuration files. This typically involves editing your shell configuration files (such as .bashrc or .zshrc) and removing the path settings related to Yarn. You should also check your user directory for any Yarn-related configuration files or directories, such as .yarnrc or the .yarn folder, and remove them.
By following these steps, you should be able to completely remove Yarn from your system. If you encounter any issues during uninstallation, consulting the official Yarn documentation or seeking help from the community is a good option.