It seems every few months setup of whatever tech stack is always tweaked a bit. This is a collection of information I used to setup my box recently. First off, for the development box I always use nvm as it is routine to need a different version of Node.js installed for various repositories and such. The best article I’ve found that is super up to date for Ubuntu 18.04 is Digital Ocean’s article (kind of typical for them to have the best article, as their blog is exceptionally good). In it the specific installation of nvm I’ve noticed has changed since I last worked with it some many months ago.
First curl download the installation script. (I’m pretty sure this often used to just execute the script, which isn’t something that should be standard practice – don’t just execute scripts from repos on the internet!)
curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh -o install_nvm.sh
Then execute the script. Review it first if you’d like, ya know, to make sure another npm credentials nightmare or something isn’t about to occur!
Now that I’ve gotten the script and run it, I can then
source ~/.profile and nvm is now available. Check out the versions available for installation with
nvm ls-remote. Next up, install a particular version, or a few, as in my case I’ll need a couple.
nvm install 6 nvm install 8.11.3
After this a ran a
nvm ls command to see what was installed altogether. Note for my installation of version 6, with the
nvm install 6 command it chose version 6.14.3 as it will choose latest for any major release version specified.
Beyond the version manager installed version there’s also the package manager on Debian/Ubuntu that can be used, but requires a few additional steps but is good if the installation will be used to host a specific Node.js application at a particular version. More details on that installation method can be found here.