Node Upgrading Node.js to latest version

July 14, 2021 . 2 MIN READ

https://stackoverflow.com/questions/10075990/upgrading-node-js-to-latest-version

Ubuntu Linux/Mac:

The module n makes version-management easy:

sudo npm install n -g

For the latest stable version:

sudo n stable

For the latest version:

sudo n latest

 

 

 

 

The current stable “LTS” version of node is 14.17.0 (2021-05-20seenodejs.org for latest.

Step 1 – Get NVM (Node Version Manger)

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash

If you’re curious about the installation command read the source code
… its been reviewed by several node.js security experts

Step 2 – Install the version of node.js you need

Once you’ve got NVM you can install a specific version of Node.js using the nvm command:

nvm install v14.17.0

Note: you may need to close & re-open your terminal window for nvm command to be available.

You should expect to see something like this in your terminal:

Now using node v14.17.0

Step 3 – Enjoy the rest of your day!

Yes, it’s that easy and didn’t require sudo!
Now please Upvote this (so others can avoid sudo-installing things!)
and have a lovely day writing node.js code!

Microsoft Windows UserUse: https://github.com/coreybutler/nvm-windows

 tl;dr

Review of the node mailing list indicates that using NVM (Node Version Manager) is the preferred way to manage your nodejs versioning/upgrading. see: github.com/nvm-sh/nvm

NVM is considered “better” than N because the verbose commands mean is much easier to keep track of what you are doing in your Terminal/SSH Log. Its also fastersaves kittens by not requiring sudo and is used by the team at NPM the node.js security experts!

 

Leave a Reply

Your email address will not be published. Required fields are marked *