2019 Solution Without using sudo!

The current stable “LTS” version of node is 10.15.3 (2019-04-03seenodejs.org for latest.

Step 1 – Get NVM (Node Version Manger)

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

If you’re curious about the installation command read the source code
… its been reviewed by several 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 v10.15

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 v10.15.3

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 UserUsehttps://github.com/coreybutler/nvm-windows

 tl;dr

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

NVM by Tim Caswell (& friends) is “better” than N from visionmedia (TJ Holowaychuk) github.com/visionmedia/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 liftsecurity.io the node.js security experts!

Also worth noting: NVM has almost three times as many GitHub Stars as N (22896 vs 8040). That’s usually – but not always – a sign of a better module… feel free to correct if you have evidence of otherwise …

P.S. this may be a dupe of How can I uninstall or upgrade my old node.js version?

ref.

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

Upgrading Node.js to latest version

Comments

comments