Don’t be afraid of the Terminal: node/npm/cli

Hello! So a long time ago I said I was going to do a series of articles on baby steps to learning React. And I’m finally going to follow through on that promise. I’ll be publishing one article a week in the series until we are through. While writing this series I’m also in the midst of building my new business site using the WordPress REST API and React. The new site will be launching Sept 1, so stay tuned after this series for some posts about that process.

Onto the main subject of the post. If you’re not used to using the terminal it can be an adjustment. If you are wanting to dive into React, you will need to take steps to make that adjustment. React is dependent on some other resources that are installed and managed via the terminal. With so many CLI (command line interface) resources including WP-CLI, a lot of developers are really comfortable navigating the command line, but just in case you aren’t one of them, here you go.

For Those Who Need a Pep Talk

When I’m training site owners how to navigate and edit in the WordPress Dashboard I usually have to be reassuring that they aren’t going to blow anything up. There’s nothing they are going to do that will “mess things up” and certainly nothing I can’t undo. The command line is similar. It abstracts some processes we are used to handling in a different way like installing or upgrading applications, and creating folders and files. It’s nothing to be afraid of. You aren’t going to accidentally type a command that makes your computer spontaneously combust. So give it a go with confidence.

You can find a lot of tutorials on CLI. Learn Enough Command Line to Be Dangerous is a good place for a total newb to start.

Commands and Options You’ll Want to Know

cd stands for change directory and lets you change to a new folder, it’s followed by the path to the desired folder.

sudo allows you to run the command as the computer administrator and will prompt you for your password.

-v allows you to check the version number of an installed package.

-g indicates that the command is run globally as opposed to locally in your current folder. Some packages may need to be installed globally and locally.

Node.js and npm

The command line isn’t specific to one coding language, but since React is JavaScript, we will be using js resources.¬†The first thing you will need to do if you have not already is install node.js. Node.js comes with npm, a package manager that allows you to install all kinds of resources right from your command line, but you may want to make sure you’ve got the most recent version of npm.

So let’s run some commands and verify node and npm are installed as well as find out what version is installed.

node -v

npm -v

And it’s really that easy. Next week we will go over more specifically some of the packages needed for development in React.

 

North UX | Level Up

Sign up for North UX updates and content on keeping your online presence poignant and trending upward.
  • This field is for validation purposes and should be left unchanged.

Leave a Reply

Your email address will not be published. Required fields are marked *