nvm-sh / nvm

Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[spam]

philliprossii opened this issue · comments

#!/bin/bash

Create a Node Version Manager (nvm) for managing multiple active Node.js versions

Check if nvm is already installed

if ! [ -x "$(command -v nvm)" ]; then
echo "nvm not found, installing..."
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
fi

Reload the shell to activate nvm

source ~/.bashrc

Install the desired Node.js version

nvm install 16.14.0

Set the default Node.js version

nvm alias default 16.14.0

Verify the installation

node -v
nvm version