Scratchpad diary: ReactJS cooking on a Digital Ocean VPS (2020)

Spread the love
55Reading Time: 2 minutes

There’s probably a ton of ways to actually get going with developing React code. You need always anyways:

  • shell
  • Node and npm installed
  • on either Mac, Windows or Linux

One of the ways is get a VPS (a light, pay-by-use server) and do development there. I had the situation where I wanted to isolate my experiments to a rather specific server. However I wouldn’t want to spend too much on the resource, as price. A VPS was a natural choice, since I had one spare.

This Post arose as I was doing code (my “React experiments”) on a Digital Ocean Linux machine. It’s a 4GB RAM, 80GB disk VPS with a Ubuntu 18.04.2 linux version on it.

I use the server to develop on, and test run React code.

There’s a couple of things I need from the server:

  • beauty of Linux tooling – gotta hone all my knee-jerk muscle memory learning hours
  • web server (to serve the React app over web)
  • Digital Ocean’s backend IP network is way faster than at my home residential ISP (so: large gigabyte installations that sometimes happens with ‘npm’ are faster)

The last point about backhaul IP capacity difference is interesting. What it practically implies is that I am balancing between the awkwardness of latency between my laptop and Digital Ocean’s VPS (typing code), and the benefits that working remotely on the VPS gives (bandwidth for large installs).

Set up latest NodeJS package

Assuming: you’re logged on to a shell on your server

I had some leftovers from previous experiments. So first thing I did was: a) uninstall the old NodeJS, and b) install latest NodeJS (the server).

Note: if you need to uninstall previous NodeJS, type in shell:

apt purge nodejs

Then verify that removal was succesful:

node --version

and you should not have node installed. Expect the shell to throw an error message. If so, good – carry on:

Set up “nvm” for better control over Node versions

Assuming: you are still logged on in a terminal on your server

https://www.freecodecamp.org/news/how-to-install-node-js-on-ubuntu-and-update-npm-to-the-latest-version/

nvm is a breeze to install. It’s basically a big script. Remember to log on again (otherwise nvm settings may not take place and you’re left with the feeling that it’s broken).

nvm allows you to actually use many different node versions independent of each other, for your Node / React / javascript projects. That’s a goodie!

Photo by Taylor Vick on Unsplash
Facebook Comments

Published by jukkasoft

Hi! A bit updated description. Code enthusiasta, technology optimist, but also a realist. In my blog I wrote 80% of technology related articles, mostly in English and Finnish. I like to envision and ponder about things, how life could be, what we are doing wrong today, and so on. "Invented" a facebook -like system in 2000, as a short product pamphlet. Haven't yet realized the 20+ ideas that might have become big things. Maybe learning this skill one of these days!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: