Upgrading Node.js via the terminal (NVM or brew)

Sh Raj - May 21 - - Dev Community

Upgrading Node.js via the terminal depends on the operating system you're using. Here are instructions for some common environments: macOS, Linux, and Windows.

macOS and Linux

Using Node Version Manager (nvm)

  1. Install nvm (if not already installed):

    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
    
- Follow the instructions in the terminal to add `nvm` to your shell profile (`.bashrc`, `.zshrc`, etc.).
Enter fullscreen mode Exit fullscreen mode
  1. Reload your shell profile:

    source ~/.bashrc  # or ~/.zshrc, ~/.profile, etc.
    
  2. Install the latest Node.js version:

    nvm install node
    
- Alternatively, you can specify a version:
Enter fullscreen mode Exit fullscreen mode
  ```sh
  nvm install 16.17.0  # replace with the desired version
  ```
Enter fullscreen mode Exit fullscreen mode
  1. Use the installed version:

    nvm use node
    
  2. Set the default version (optional):

    nvm alias default node
    

Using Homebrew (macOS only)

  1. Update Homebrew:

    brew update
    
  2. Upgrade Node.js:

    brew upgrade node
    

Windows

Using nvm-windows

  1. Download nvm-windows from the nvm-windows releases page.

  2. Install nvm-windows by running the installer.

  3. Open Command Prompt or PowerShell as Administrator.

  4. Install the desired Node.js version:

    nvm install latest
    
- Alternatively, you can specify a version:
Enter fullscreen mode Exit fullscreen mode
  ```sh
  nvm install 16.17.0  # replace with the desired version
  ```
Enter fullscreen mode Exit fullscreen mode
  1. Use the installed version:

    nvm use latest
    

Verifying Installation

After upgrading, verify the installed Node.js version by running:

node -v
Enter fullscreen mode Exit fullscreen mode

This should output the version of Node.js that you have just installed.

By following these steps, you should be able to upgrade Node.js to the desired version on your system.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player