Aprovecha el precio especial y haz tu profesión a prueba de IA

Antes: $249

Currency
$209
Suscríbete

Termina en:

2 Días
17 Hrs
56 Min
22 Seg
Curso de Fundamentos de Node.js

Curso de Fundamentos de Node.js

Oscar Barajas Tavares

Oscar Barajas Tavares

Instalación y configuración del entorno de Node.js

2/20
Resources
Transcript

Node.js version management is a fundamental skill for any developer working with this technology. Although initially it may seem sufficient to have the latest version installed, the reality of web development often involves working with projects that require specific versions. Mastering this management will allow you to move fluidly between different development environments and maintain the compatibility of your applications.

Why do you need to manage multiple versions of Node.js?

When you join a development team or take over an old but functional project (where the "if it works, don't touch it" rule applies), you will most likely encounter code that was built for a specific version of Node.js. In these cases, you will need to switch to that particular version to run the project correctly.

Version management allows you to:

  • Simultaneously work on projects that require different versions of Node.js.
  • Test your code in different runtime environments
  • Maintain compatibility with older projects
  • Explore new features available only in specific versions

Understanding Node.js version types

Before learning how to manage versions, it is important to understand the different types that exist:

  • Current: The most recent version with the latest features, currently version 23.8.
  • LTS (Long Term Support): Version with extended support, currently 22.14, recommended for production projects.
  • Maintenance: Versions that only receive security updates, ideal for projects that will not be modified but need to be kept secure.

The LTS version is generally recommended for production environments, as it offers stability and extended support, minimizing the risk of unexpected bugs that may appear in newer versions.

How to install and configure NVM (Node Version Manager)?

NVM is the tool par excellence for managing multiple versions of Node.js on the same system. This script allows you to install, uninstall and switch between different versions according to your needs.

Installing NVM

To install NVM, follow these steps:

  1. Open your terminal
  2. Run the following command:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
  1. Add the configuration to your terminal profile file:
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"
  1. Update your terminal configuration:
source ~/.bashrc # If you use Bashsource ~/.zshrc # If you use ZSH.
  1. Verify the installation:
nvm -v

This process is fairly standard regardless of the operating system you are using. If you are on Windows, it is recommended to use Windows Subsystem for Linux (WSL) to access Unix commands. MacOS and Linux users already have these commands available by default.

Basic NVM commands

Once NVM is installed, you can use these essential commands:

  • List installed versions:
nvm ls
  • Install a specific version:
nvm install 23 # Installs the latest version 23.xnvm install 22 # Installs the latest version 22.x (current LTS)nvm install 22.14.1 # Installs a specific version.
  • Switch between versions:
nvm use 23 # Switches to version 23nvm use 22 # Switches to version 22nvm use default # Switches to default version.
  • Check the current version:
node -v

How to choose the right version for each project?

The choice of Node.js version will depend on the specific context of your project:

For projects in production

It is recommended to use the LTS version, as it offers:

  • Greater stability with less disruptive changes
  • Long-term support with security updates
  • Compatibility with most popular packages

For development or experimental projects

You can opt for the Current version to:

  • Test the latest languagefeatures
  • Experiment with performance improvements
  • Prepare for future upgrades

For legacy projects

You will need to identify the specific version with which the project was developed, which can be found in:

  • The package.json file ("engines" field)
  • The project documentation
  • Consulting with the original team

Efficient Node.js version management is a skill that will save you a lot of headaches and allow you to quickly adapt to different development environments. Have you ever had to deal with version compatibility issues? Share your experience and the solutions you found.

Contributions 5

Questions 3

Sort by:

Want to see more contributions, questions and answers from the community?

Quienes en el 2025 haciendo el curso de NodeJS Actualizado 🎯
Si funciona no lo toques, instala varias versiones de node y no te compliques
una opcion mas rapida q npm es **pnpm** se utiliza igual q **npm** sin tanta complicacion pero es **considerablemente mas rapido.**
La clase trata sobre la instalación y configuración del entorno de Node.js, centrada en la gestión de versiones. Se explica la importancia de tener múltiples versiones de Node para proyectos específicos y cómo utilizar NVM (Node Version Manager) para manejar estas versiones. Se discuten los tipos de versiones de Node: la más reciente, la LTS (Long Term Support) y las versiones que solo reciben actualizaciones de seguridad. Finalmente, se muestran los pasos para instalar NVM y cambiar entre versiones según las necesidades del proyecto.
Particularmente me gusta usar NVS para el mismo proposito https://github.com/jasongin/nvs Lo único que veo es que no la han actualizado hace 2 años 🤔