Skip to content

Instantly share code, notes, and snippets.

@clochix
Created November 3, 2015 12:44
Show Gist options
  • Save clochix/4b8576b1eac17b45d012 to your computer and use it in GitHub Desktop.
Save clochix/4b8576b1eac17b45d012 to your computer and use it in GitHub Desktop.
Using Debian alternative system to switch between versions of Node.js
To switch easily between Node versions on Debian, instead of tools like [nvm](https://github.com/creationix/nvm), you can just use [Debian's native alternatives system](http://www.debian-administration.org/article/91/Using_the_Debian_alternatives_system).
(the following commands require root privilege)
- download and install the node executables under /usr/local/bin/nodes/…
- add this binaries to the alternative system:
update-alternatives --install /usr/bin/node node /usr/bin/nodejs 100
update-alternatives --install /usr/bin/node node /usr/local/bin/nodes/0.10.38/nodejs 50
- to switch between versions, just call `update-alternatives --config node`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment