Uninstall and reinstall NVM on Linux

NVM (Node Version Manager) is a handy tool for managing and switching between different versions of Node.js on the same machine. Sometimes, we may need to uninstall NVM and reinstall it, to solve some problems or to update. In this blog post, we will provide steps to uninstall and reinstall NVM on Linux.

uninstall NVM

  1. Open a terminal or command line interface.

  2. Unmount NVM with the following command:

    rm -rf ~/.nvm
    

    This will delete NVM related files and directories.

  3. Confirm whether NVM has been successfully unmounted. Run the following command:

    nvm --version
    

    If the command cannot find nvm, it means that NVM has been successfully unmounted.

Reinstall NVM

  1. Open a terminal or command line interface.

  2. Download the installation script for NVM using the following command:

    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
    

    Or, if you're using wget:

    wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
    
  3. After running the above command, NVM's installation script will download and install NVM. Follow the script's prompts.

  4. Once installed, run the following command in a terminal to load NVM:

    source ~/.nvm/nvm.sh
    

    You can also add this command to your terminal configuration file (eg .bashrc, .bash_profileor .zshrc) to have NVM automatically loaded every time you open a terminal.

  5. Verify that NVM is installed successfully. Run the following command:

    nvm --version
    

    If the output shows the version number of NVM, the installation was successful.

Now you have successfully uninstalled and reinstalled NVM. You can use NVM to manage and switch between different Node.js versions.

Note that the specific steps may vary depending on your Linux distribution and personal environment. Make sure to read and understand each command carefully as you perform these steps, and make appropriate adjustments as needed.

If you want to know more details and usage of NVM, please refer to the official documentation of NVM or its GitHub repository.


Hope this blog can help you! If you have any questions or need further guidance, please feel free to ask.

Guess you like

Origin blog.csdn.net/qq_39997939/article/details/131351454
Recommended