Node and npm

Get familiar with Node and npm.

Installing Node and npm

The JavaScript landscape has changed dramatically in the last eight years, and nothing bears as much responsibility for those changes as Node.js (“Node” for short). JavaScript was created at Netscape in 1995 to run in one specific place: the browser. Since then, server-side JavaScript has been attempted in various forms but without much success. Node changed all that. Today, JavaScript powers millions of servers, rivals Ruby and Python in popularity as a scripting language, and lies at the core of many rich desktop apps. For example, VS Code, which is a full-featured editor you’ll meet in the next chapter. Thanks to Node, JavaScript is everywhere.

Check if you have Node installed by running node -v:

$ node -v
v8.12.0

If that command runs and gives you version 8 or higher, you’re good to go. If not, go to NodeJS.org to download and install the latest LTS (long-term support) release. If it still doesn’t run, you may need to add the node executable to your command-line shell’s PATH.

The Node installer should also have included an executable called npm:

$ npm -v
6.4.1

Officially, npm (never capitalized) is not an acronym. But colloquially, it’s known as the node package manager. And as we’ll soon see, it’s an indispensable tool.

You can check the npm and node version in the terminal below using the commands above.

Get hands-on with 1200+ tech skills courses.