In my previous posts I detailed by Gitea and Jenkins setup. We’re now ready to get NodeJS setup. First we’ll get nvm setup. This allows us to easily install and switch the version of NodeJS we can use.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
That will begin the nvm installation process and should leave you with an usable nvm. Let’s make sure by doing the following:
pi@raspberrypi:~ $ nvm --version0.35.3
Excellent – that means it’s installed and ready to go. Now, I’ll be using the latest version of node so let’s get that installed
pi@raspberrypi:~ $ nvm install node
v14.0.0 is already installed.
Now using node v14.0.0 (npm v6.14.4)
That means I’ve already installed the latest and it’s ready to go. Note that it also installed npm for us. If you’re doing this for the first time you’ll see some information about what it’s doing and will still end with which nodejs version it is now set as the main one.
Let’s also install the LTS version of NodeJS:
pi@raspberrypi:~ $ nvm install --lts
Installing latest LTS version.
Downloading and installing node v12.16.2...
Downloading https://nodejs.org/dist/v12.16.2/node-v12.16.2-linux-armv7l.tar.xz...
########################################################################################################################################################################################################## 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v12.16.2 (npm v6.14.4)
Now we’ve got two versions of NodeJS but I really want to use the latest and greatest. I’m like that. So let’s switch back to v14.0.0:
pi@raspberrypi:~ $ nvm use v12.16.2
Now using node v12.16.2 (npm v6.14.4)
All good it seems. Now we also want to install npx. From the NPM Blog:
npx is a tool intended to help round out the experience of using packages from the npm registry — the same way npm makes it super easy to install and manage dependencies hosted on the registry, npx makes it easy to use CLI tools and other executables hosted on the registry. It greatly simplifies a number of things that, until now, required a bit of ceremony to do with plain npm
https://blog.npmjs.org/post/162869356040/introducing-npx-an-npm-package-runner
pi@raspberrypi:~ $ npm install -g npx
[ ...........] \ extract:npx: verb lock using /home/pi/.npm/_locks/staging-887cff9
That will run off and install npx globally (the -g option). Let’s check it’s installed and working:
pi@raspberrypi:~ $ npx -v
6.14.4
I’ll be using this later for creating my ReactJS front-end and so on. We’ve not installed NodeJS, npm (got installed with NodeJS), nvm and nvx.
Hope this helps. Next up I’ll be setting up some workflow!



