How To Reinstall Node And Yarn For Zsh

Hey there! So, you’re looking to reinstall Node and Yarn for Zsh? I’ve got you covered. After going through a similar process myself, I’ve compiled a detailed guide to help you through it. Let’s dive in!

Uninstalling Node and Yarn

Before reinstalling Node and Yarn, it’s essential to properly uninstall the existing versions. Open up your terminal and run the following commands:


brew uninstall node
brew uninstall yarn

Removing NVM (Node Version Manager)

If you’ve been using NVM to manage your Node versions, it’s important to remove it as well. Run the following command:


rm -rf ~/.nvm

Checking Zsh Configuration

Make sure to check your Zsh configuration files to see if there are any references to the previously installed Node and Yarn versions. Look for any lines related to Node and Yarn in your .zshrc or any other relevant configuration files and remove them.

Reinstalling Node and Yarn

Now, it’s time to reinstall Node and Yarn using Homebrew. First, update Homebrew to ensure you have the latest package information:


brew update

Then, proceed to reinstall Node:


brew install node

Followed by Yarn:


brew install yarn

Verifying the Installation

After the installation is complete, verify that Node and Yarn are properly installed by running the following commands:


node -v
yarn -v

Setting up Zsh Environment

To ensure that Zsh recognizes the newly installed Node and Yarn, add the following lines to your .zshrc file:


export PATH="/usr/local/opt/node@14/bin:$PATH"
export PATH="$PATH:`yarn global bin`"

Reloading Zsh Configuration

After making changes to your .zshrc file, reload the Zsh configuration using the following command:


source ~/.zshrc

Wrapping Up

And there you have it! You’ve successfully reinstalled Node and Yarn for Zsh. Hopefully, this guide has been helpful in getting your development environment back up and running smoothly.

Conclusion

Reinstalling Node and Yarn for Zsh can sometimes be a bit tricky, but with the right steps, it’s totally manageable. Remember, keeping your development environment tidy and up-to-date is crucial for a seamless workflow. Happy coding!