Setting Up a Dev Machine for Node.js

DZone 's Guide to

Setting Up a Dev Machine for Node.js

Node.js has quickly become one of the most popular frameworks for backend web development. Read on to learn how to set it up on your development machine.

· Web Dev Zone ·
Free Resource

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 is 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!

bash install_nvm.sh

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; in my case, I'll need a couple.

nvm install 6
nvm install 8.11.3

After this, I 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 the latest iteration 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 this requires a few additional steps; but it 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.

For more, follow me @Adron on twitter, @Adron on Github, and subscribe to my blog at https://compositecode.blog.

node.js, tutorial, web dev

Published at DZone with permission of Adron Hall , DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}