

Installing Node.js and npm from the Ubuntu repository #Īt the time of writing, the Node.js version included in the default Ubuntu 22.04 repositories is v12.22.9 which is an older TLS version. If you are not sure which Node.js version to install, consult the documentation of the application you’re going to deploy. If you are Node.js developer, then this is the preferred way of installing Node.js.Ĭhoose the installation method that is most appropriate for your environment. This tool allows you to have multiple Node.js versions installed on the same machine.

Currently, NodeSource supports Node.js v18.x, v17.x, v16.x, and v14.x. Use this repository to install a different Node.js version than the one provided in the Ubuntu repositories. The version included in the Ubuntu repositories is v12.22.9. This is the easiest way to install Node.js and npm on Ubuntu and should be sufficient for most use cases.

If you want to see all the versions of a package, you can do it with the following command: npm view package_name versions When running the above command, npm installs the version specified after the symbol. The above commands install the latest version of the specified package.īut what if you want to install a specific version? The syntax for installing a particular package version is as follows: npm install _number Note: npm i is the shortcut for npm install.

With npm, you install a package as follows: npm install package_name You will learn to do it using both yarn and npm. This article shows you how to install a specific package version to avoid such situations. One example would be when the latest changes in a package are not compatible with your code. But there are circumstances when you might need to install a specific package version. Usually, you install the latest version of a package when you want to use it.
