Option 3 - Installing Node Using the Node Version ManagerĪnother way of installing Node.js that is particularly flexible is to use nvm, the Node Version Manager.
#LINUX INSTALL NODEJS HOW TO#
The next section will show how to use the Node Version Manager to install and manage multiple versions of Node.js. The NodeSource nodejs package contains both the node binary and npm, so you don’t need to install npm separately.Īt this point you have successfully installed Node.js and npm using apt and the NodeSource PPA. Verify that you’ve installed the new version by running node with the -v version flag: You can now install the Node.js package in the same way you did in the previous section:
![linux install nodejs linux install nodejs](https://www.devopsschool.com/blog/wp-content/uploads/2020/01/image-68.png)
The PPA will be added to your configuration and your local package cache will be updated automatically. When you are satisfied that the script is safe to run, exit your editor, then run the script with sudo: Inspect the contents of the downloaded script with nano (or your preferred text editor):
![linux install nodejs linux install nodejs](https://blog.nevercodealone.de/wp-content/uploads/2020/10/nodejs-logo-1024x512.png)
Refer to the NodeSource documentation for more information on the available versions.
![linux install nodejs linux install nodejs](https://benisnous.com/wp-content/uploads/2021/01/install-node-js-version-14-LTS-for-Linux.jpg)
Option 2 - Installing Node.js with Apt Using a NodeSource PPA The next section will show how to use an alternate repository to install different versions of Node.js.
#LINUX INSTALL NODEJS SOFTWARE#
This will allow you to install modules and packages to use with Node.js.Īt this point you have successfully installed Node.js and npm using apt and the default Ubuntu software repositories. You can do this by installing the npm package with apt: In most cases, you’ll also want to also install npm, the Node.js package manager. If the package in the repositories suits your needs, this is all you need to do to get set up with Node.js. This will not be the latest version, but it should be stable and sufficient for quick experimentation with the language. At the time of writing, the version in the repositories is 10.19. Ubuntu 20.04 contains a version of Node.js in its default repositories that can be used to provide a consistent experience across multiple systems. Option 1 - Installing Node.js with Apt from the Default Repositories You can learn how to do this by following the Ubuntu 20.04 initial server setup tutorial. Before you begin, you should have a non- root user account with sudo privileges set up on your system. This guide assumes that you are using Ubuntu 20.04.
![linux install nodejs linux install nodejs](https://www.javatpoint.com/js/nodejs/images/install-nodejs-on-linux9.png)
If you are actively developing Node applications and need to switch between node versions frequently, choose the nvm method. If you need specific newer (or legacy) versions of Node, you should use the PPA repository.