Welcome to the first in a multi-part blog series on the new Now Experience tools in Orlando version of ServiceNow.
Today I’ll be helping you understand what this page actually means, and diving a bit deeper into what you are actually doing to your computer to make this magic work.
- You are proficient using your computer, and know what operating system you are on, and how to get to the command line interface.
PLEASE NOTE: I’m not a professional web developer, but I have been playing with the basic tools that you need to get up and running for around 12 months in my spare time. Everything I say here is my own experiences, may not be 100% correct and is probably only skimming the surface of the technology, but it’s how I wish someone had explained things to me when I started out.
Lets get into it…
Part 1: Package Managers
Package managers: They are everywhere, but what are they? When I started learning about this new thing called “NodeJS” I wish I had realised the following thing:
Package Managers are like an App Store for your command line
Command line tools to install applications have been around forever in Linux, and if you have ever set up a Raspberry Pi you have probably used
apt-get, one of the linux package managers.
The difference with package managers from just downloading the app is they allow you to install all the other, dependant apps to run the thing you want, right off the bat. They also have neat features like calling a single
update command to update all the packages you have installed, and all the dependencies within them.
Once that’s done, make sure it works by running the “version” command in your command line: e.g.
brew --version - you should get an output like the following:
computer:~ aalburydor$ brew --version Homebrew 2.2.10 Homebrew/homebrew-core (git revision 689c8; last commit 2020-03-15)
Now we have your Operating System package manager installed, we need to look at the next requirement from the docs: Node
To use the Now Experience CLI you are going to need a few things (as per the docs):
Install the most recent LTS version of Node.js.
Part 2: What is Node? Baby don’t serve me…
We are going to be using it to allow local development of the components, rather than having to upload everything to your ServiceNow instance to test.
NOTE: Node updates pretty frequently, and that’s why ServiceNow tells us to use the latest “LTS” or Long Term Support version.
One of the big problems I have seen with Node and projects like this is version compatibility, so to assist with this we are going to install a tool called “Node Version Manager” or NVM. This lets you install and run multiple versions of Node, and takes care of a lot of the problems you find with the initial setup.
- Install Node Version Manager
- Run the following command in MacOS:
brew install nvm
choco install nvm
- Run the following command in MacOS:
after some time the install should complete, and you can confirm by calling
nvm --version (again, checking an installation with a version call)
computer:~ aalburydor$ nvm --version 0.35.3
Now install the latest LTS version of Node via NVM
nvm install --lts
(This is the same on all operating systems)PLEASE NOTE: As per comment from Rick Forristall on Windows 10 you may need to specify the version manually, so run
nvm install 12.16.1, Thanks Rick!
Set the latest LTS version of Node as active
nvm use --ltsAGAIN, NOTE: On windows run
nvm use 12.16.1
The best part about using NVM to install Node is that you don’t have to know anything about where or how it’s installing it. All your environment variables, all your OS-level settings are taken care of. After that’s finished, once again, you can test this with
computer:~ aalburydor$ node --version v12.16.1
Part 3: Here’s Where Things Get Confusing
NodeJS comes with it’s own package manager, NPM (Node Package Manager) which of course is another 3-letter N-based acronym. Fun, isn’t it?
Let’s make sure NPM is working with, you guessed it, a version call:
computer:~ aalburydor$ npm --version 6.13.4
Now, finally, we can get to Step 2 on the Docs page: Installing the Now Experience CLI! Run the following command:
npm install @servicenow/cli -g
-gin a NPM install command installs the package “globally” into your use profile, so you can call this command anywhere on your system.
Finally, and what may actually be the last time, make sure Now-CLI has installed correctly:
computer:~ aalburydor$ now-cli --version Now CLI @17.0.1
Congratulations! You have now successfully completed two dot points from the docs!
Today we have completed (and understood, hopefully!) the following:
- Install a package manager for apps on our computer
- Install Node Version Manager to give us more control over Node
- Install the latest LTS version of Node + NPM
- Install the Now-CLI tool as a Global node package, to run anywhere on your system
- Read a whole heap of words. I’M SORRY!
Having written all this out, I can see why two dot-points on the docs might have confused some people, when it took me almost 1000 words to do a basic explanation.
Stay tuned for Part 2: Making a Thing!