Instalar nvm ubuntu

De enunpimpam
Revisión del 08:17 22 sep 2025 de Nacho (discusión | contribuciones) (Página creada con «1.Update your system's package list to ensure you have the latest package information: sudo apt update && sudo apt upgrade -y 2. Install the curl utility if it is not alr…»)
(dif) ← Revisión anterior | Revisión actual (dif) | Revisión siguiente → (dif)
Saltar a: navegación, buscar

1.Update your system's package list to ensure you have the latest package information:

sudo apt update && sudo apt upgrade -y

2. Install the curl utility if it is not already present, as it is required to download the NVM installation script:

sudo apt install curl -y

3. Download and run the official NVM installation script. The most recent version of NVM as of the provided context is v0.40.3, but you should check the NVM GitHub repository for the latest release.

Use the following command:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash   

4. After the installation script completes, you need to load NVM into your current shell session. Run the following command to source the NVM script:

export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"

[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"

5. To make the NVM configuration persistent across all future terminal sessions, add the export and source commands from step 4 to your shell's startup file (~/.bashrc for bash or ~/.zshrc for zsh). For bash, you can use:

echo 'export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"' >> ~/.bashrc

echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"' >> ~/.bashrc

Then, reload your shell configuration:

source ~/.bashrc   
nvm --version