Keeping your Node.js version up to date is essential to ensure security and take advantage of the latest features. You can check current node version using the command node --version
.
There are multiple ways of updating the node version in our system. Here are some of them:
Updating via NVM (Node Version Manager)
- install nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
- start nvm:
source ~/.nvm/nvm.sh
- specify node version:
nvm install 18
- use it:
nvm use 18
Thats it! You can verify the version using node -v
.
Manual Update from the Official Website:
You can also update Node.js manually by following these steps:
- Visit the official Node.js website
- Download the latest stable version.
- Run the installer and follow the instructions.