There are several ways to check the Node version you’re using. You can use basic command line prompts, npmnpm is a software registry that serves over 1.3 million packages. npm is used by open source developers from all around the world to share and borrow code, as well as many businesses. There are three components to npm: the website the Command Line Interface (CLI) the registry Use the website to discover and download packages, create user profiles, and..., or nvm as well to do it. In this article below, we list ways for you to check your Node version with different methods, on different operating systems.
Check your Node version in one step
To check the version of Node.js on your computer (may it run MacOS, Windows or a Linux distro such as Ubuntu), run the following command:
$ node -v
This will return the current version of node that is installed on your system.
If you want to learn more about Node.js, you can find instructions and official docs on the node website. https://nodejs.org/en/download/
To check the latest version of Node for both the LTSLTS means long-term support. The acronym is often used to mark Node.js release lines that will be maintained and supported for an extended period. There are two separate kinds of LTS releases: Active and Maintenance. The Active release line often gets new features and other improvements beside security patches and bug fixes, and the Maintenance only gets the latter. It... and Current versions, check out our blog post that collects and lists all major updates.
Using npm to check your node version (and also update it)
Alternatively, you can use a package manager like npm to update Node.
$ npm install -g npm@latest
$ npm update -g node
will update node and npm.
If you are having issues with your node installation, you can try the following commands:
$ npm cache clean
$ npm install -g --unsafe-perm node
These commands will try to clean up any issues with your npm cache and install Node with permissions that may help resolve any installation issues.
To only check your npm version, you can use the following command:
$ npm -v
Managing your Node versions with nvm
NVM (Node Version Manager) is a bash script that allows you to manage multiple active versions of Node.js. It allows you to install, uninstall, list, and switch between node versions.
The preferred way for managing your local node.js versions is to use nvm, which can be installed like this:
curl https://raw.githubusercontent.com/creationix/nvm/v0.33.3/install.sh | bash
Then, use this to install node.js:
$ nvm install node
To use a specific version of node.js, you can do:
$ nvm use node
If you want to uninstall node.js, you can type:
$ nvm uninstall node
To update Node to the latest LTS version, you can use the nvm update node command.
For further details on how to install specific versions, see the nvm docs: https://github.com/nvm-sh/nvm
If you’re using Windows, you’ll need to use nvm-windows, which has almost the same API as nvm, but is a completely different project, and has a different philosophy. https://github.com/coreybutler/nvm-windows
What is Node.js?
If you are already familiar with Node, but need a quick refresher about it, we’ve got you covered:
Node.js is open-source and free to use. It also provides a first-class development experience, making it an ideal platform for web-based applications. Node.js also has a large community of developers who are constantly creating new modules and libraries to make development easier.
There are a few things to keep in mind when writing Node.js applications. First, since Node.js is asynchronous, you need to use promises, asyncAsynchrony, in software programming, refers to events that occur outside of the primary program flow and methods for dealing with them. External events such as signals or activities prompted by a program that occur at the same time as program execution without causing the program to block and wait for results are examples of this category. Asynchronous input/output is an... functions, callbacks or events to handle data flow. Second, Node.js is single-threaded, so you need to be careful not to block the thread with long computations.
How the Node release schedule works
A few words about the Node.js release schedule:
Node.js releases are identified by a major and minor version number, e.g. v4.2.0. Minor version releases (e.g. v4.2.1) are made every few weeks and contain new features and bug fixes. Major version releases (e.g. v5.0.0) are made every six months or so and may contain breaking changes.
Nowadays, the LTS (long-term support) Node.js versions get an even number, like 16.14.0, while Current releases have an odd version number, like 17.5.0.