Skip to content

Instantly share code, notes, and snippets.

@santisbon
Last active March 16, 2023 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save santisbon/b2daefc16e9078b22e84 to your computer and use it in GitHub Desktop.
Save santisbon/b2daefc16e9078b22e84 to your computer and use it in GitHub Desktop.
Allows having different versions of #node in UNIX-based systems. If you just want to update node on OS X or Windows you can run the installer downloaded from the NodeJS site.
#!/bin/bash
sudo su
npm cache clean -f
# The n package is a Node helper
npm install -g n
# Instead of using "stable", you could specify a version:
# n 4.4.0
n stable
# Create link to the latest nodejs installed binary file
ln -sf /usr/local/n/versions/node/5.8.0/bin/node /usr/local/bin/node
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment