4 min read · Feb 26, 2022
For some odd reason, installing software is a difficult task for me. Maybe it’s my ADHD that causes me to skip around those extremely long articles. Maybe it’s the technical jargon that throws me for a loop. Either way, I always end up missing a step or downloading the wrong thing. However, as a technical writer, I spend my days breaking down and streamlining information so that it can be easily digestible. There’s no problem too big or software too complex once you get to the nitty gritty, that includes something as “simple” as software installation. Today, we tackle Node.js and NPM.
Prerequisites
— Users should have some familiarity with a command line tool (Windows Command Prompt, PowerShell, Git Shell, etc.)
Objectives
— Users will be know how to check if node.js is already installed using a command line tool.
— Users will be able to use a command line tool to install and test Node.js and NPM.
— Users will know how to update Node.js.
— Users will know how to uninstall Node.js.
What is Node.js?
Node.js® is a server-side JavaScript-based environment built on Google Chrome’s JavaScript Engine (V8 Engine). It was developed by Ryan Dahl in 2009 and its latest version is v16.14.0. According to official documentation Node.js is defined as−
A Node.js app runs in a single process, without creating a new thread for every request. Node.js provides a set of asynchronous I/O primitives in its standard library that prevent JavaScript code from blocking and generally, libraries in Node.js are written using non-blocking paradigms, making blocking behavior the exception rather than the norm.
You can also use Node.js to perform helpful tasks on your computer such as concatenating and minifying JavaScript files and compiling Sass files into CSS.
What is NPM?
NPM is a “package manager” that makes installing Node “packages” fast and easy. A package is just a code library that extends Node by adding useful features. For example, the “request” package simplifies the process of making HTTP requests so you can easily get web resources from other sites.
Note: NPM is automatically installed when you install Node.js®
Step 1: Check to see if Node.js is already installed
To see if Node is installed, open the Windows Command Prompt, Powershell or a similar command line tool, and type “node -v”.
Note: This should print the version number so you’ll see something like this v0. 10.35.
Step 2: If Node.js isn’t installed, download the windows installer from the official node.js website.
Step 3: Run the Installer (the .msi file that was previously downloaded)
Step 4: Follow the prompts in the Node.js Setup Wizard
Step 5: Restart your computer (you won’t be able to run node.js until computer restarts)
Step 6: Test Node.js and NPM
Step 6.1: Test Node
Open your command line tool and type “node -v”. If installed successfully, the current version number will be printed. (Current version: v16.14.0)
Step 6.2: Test NPM
In your command line tool, type “npm -v”. If installed successfully, the current version number will be printed. (Current version: 8.3.1)
Step 6.3: Create & Run Test File
Create a new file called “hello.js”. Add the following line of code to your js file “console.log(‘Node is installed’);”. To run the code, open your command line program, navigate to the folder where your program is saved, and type “node hello.js”. This command will start node.js and run the code you saved in the file.
Update Node.js and NPM
New versions of Node.js and NPM come out frequently. To install the updates, just download the installer from the Nodejs.org site and run it again. The new version of Node.js and NPM will replace the older versions.
Uninstall Node.js and NPM
Step 1: Open Windows Control Panel
Step 2: Choose “Programs and Features” option
Step 3: Click “Uninstall a program”
Step 4: Select node.js ad clock the uninstall link
Step 5: In your command line tool, type “node -v” (if successfully uninstalled, you should see “‘node’ is not recognized as an internal or external command, operable program or batch file.”
One thing I’m learning as I continue being a life-long learner of tech is that I have to really sit down with information in order for me to actually understand it, but I still need the information that’s presented to me to get to the point. A lot of guides and documentation give a lot of fluff and my brain isn’t a big fan of unnecessary information. Hopefully this guide helps you streamline your instillation process because it surly simplified things for me. Remember friends, do or do not; there is no try. Happy learning!