Following the tutorial https://www.digitalocean.com/community/tutorials/how-to-deploy-a-nestjs-application-with-nginx-on-ubuntu. To fulfill the prequesit of installing node I used the command: sudo apt install nodejs This installed node 18.19.1. On my local machine I am using 20.9.0. How do I upgrade to this version
At the end of the day I would like to get my dockerised nestjs api deployed from github but am assuming I need node there first
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Sign up for Infrastructure as a Newsletter.
Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Heya,
To upgrade Node.js to a specific version like 20.9.0 on your Ubuntu server, you typically need to use a version management tool like Node Version Manager (NVM) or the NodeSource binary distributions. These tools allow you to install and switch between multiple Node.js versions easily. Since you’re using a newer version that might not be available in the default Ubuntu repositories, using NVM is a particularly flexible approach.
Using NVM (Node Version Manager)
NVM allows you to install and manage multiple versions of Node.js. Here’s how to set it up and use it to install Node.js version 20.9.0:
This will download and run the installation script. The script will clone the NVM repository to
~/.nvm
and add the source line to your profile (~/.bashrc
,~/.zshrc
,~/.profile
, or~/.bash_profile
).Hey!
One option is to follow the steps here:
First, install the PPA to get access to its packages. From your home directory, use
curl
to retrieve the installation script for your preferred version, making sure to replace20.x
with your preferred version string (if different):Another way of installing Node.js that is particularly flexible is to use nvm, the Node Version Manager. This piece of software allows you to install and maintain many different independent versions of Node.js, and their associated Node packages, at the same time:
Let me know how it goes!
Best,
Bobby