02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School
Previous VideoNext Video

Installing Node.js and NPM on Your Desktop

Installing Node.js and NPM on Your Desktop

In this tutorial, we will guide you through the process of installing Node.js and NPM on your desktop. Whether you're using Windows, MacOS, or Linux, this guide will help you set up a development environment for working with Node.js, enabling you to create powerful full stack applications. This tutorial was created in 2016, and we have added notes to cover important updates since then.

Step 1: Downloading Node.js

To begin, you'll need to download the Node.js installer from the official Node.js website. For stability and support, we recommend downloading the LTS (Long-Term Support) version.

  1. Visit https://nodejs.org.
  2. Choose the LTS version for your platform: Windows, MacOS, or Linux.
  3. Click the download button to get the installer.

Critical Update (2024): As of recent updates, Node.js has introduced new features and more frequent releases. Always make sure you use the LTS version for long-term stability in your projects.

Step 2: Installing Node.js and NPM

Once the installer is downloaded, you can proceed with the installation. The Node.js installer also includes NPM (Node Package Manager), which is a crucial tool for managing libraries and dependencies.

Windows Installation

  1. Run the Installer: Locate the downloaded .msi file and run it.
  2. Follow the Setup Wizard: Make sure to check the box to add Node.js to your system PATH.
  3. Complete the Installation: Finish the installation process by following the prompts.

MacOS Installation

  1. Open the Installer: Locate the .pkg file and double-click to open it.
  2. Follow the Prompts: Complete the setup process by following the instructions.

Linux Installation

For Linux users, you can install Node.js via the package manager.

  1. Open Terminal: Use the terminal to install Node.js.
  2. Install Using apt (Debian/Ubuntu):
    sudo apt update
    sudo apt install -y nodejs npm
    

Critical Update (2024): For managing multiple versions of Node.js, it is recommended to use nvm (Node Version Manager). This allows you to easily switch between Node.js versions, especially when working on different projects.

Step 3: Verifying Installation

To verify that Node.js and NPM have been installed correctly, open your terminal or command prompt and type the following commands:

node -v
npm -v

These commands will display the installed versions of Node.js and NPM. If you see version numbers, it means the installation was successful.

Note: It is important to keep both Node.js and NPM updated to the latest versions to take advantage of security patches and new features.

Step 4: Configuring Node.js

After installing Node.js and NPM, you can configure your development environment by installing globally useful packages:

  • nodemon: Automatically restarts your Node.js application when file changes are detected.

    npm install -g nodemon
    
  • npm-check-updates: Helps you keep your project dependencies up to date.

    npm install -g npm-check-updates
    

Conclusion

By the end of this tutorial, you should have Node.js and NPM installed and ready to use on your desktop. This setup is essential for developing modern JavaScript applications, including full stack projects with React. With Node.js and NPM installed, you're well on your way to building dynamic, server-side JavaScript applications.

Reminder: Always use the LTS version of Node.js for stability, and consider using nvm if you need to manage multiple Node.js versions for different projects.

Video Transcript

00:00Welcome back.
00:01And in this lecture we're gonna go ahead and set up
00:04and install no js and NPM onto your desktop.
00:08And what that means is exactly that,
00:11but we're gonna talk about the differences
00:13between production versus the latest build
00:15and which one should you be working on in general
00:18for the sake of working with the latest.
00:21We're gonna go ahead and use the latest builds
00:23and show you the latest technologies.
00:26But in a real world scenario, you might wanna work
00:28with a production version for something
00:30that's gonna go live immediately.
00:32Uh, with that said, by the end of this lecture,
00:34we're gonna have no JS
00:35and MPM installed onto our desktop,
00:38so let's jump right into it.
00:40Now, if you're on Windows, make sure
00:42to check the previous video where we installed
00:44and set up sgu, uh, to enable us to work with the terminal.
00:49Alright, so, uh, now when you're gonna go
00:51through the installation, you're gonna go onto no js.org.
00:56You're gonna be confronted between two options,
00:59the recommended for most users version,
01:01which is the stable version versus the
01:04latest features, latest version.
01:06Because we're an educational video, we're gonna go ahead
01:09and use the current most latest features.
01:11But if you're working towards building something
01:14that is gonna go into production,
01:16you're better off using the latest, uh, recommended version
01:20and not the latest, latest version
01:22with all the latest features.
01:24But I'm gonna go ahead and click onto the version six.
01:27Make sure that you download it to your operating system.
01:29If you don't see your operating system,
01:31then click onto other downloads
01:33and find the package that's most fitting
01:35for your operating system.
01:38And I'm gonna go ahead and download the package.
01:40And once the download is complete, I'm gonna go ahead
01:43and install the package.
01:45Now I'm gonna keep everything in its default configurations,
01:48but make sure that you read the legal documentation
01:51and agree to the terms within it.
01:54I am, I do agree to it,
01:56and I'm gonna keep the destination, the installation type,
01:59everything about it as default.
02:01And last but not least, also,
02:03I'm gonna type in my administrator password on Mac
02:06to make sure that this application could install
02:08and change configurations that it needs to be able
02:11to create a server.
02:13Now, no, once we've completed installation, no JS is going
02:18to be installed and is gonna be located in this file path,
02:21which you might wanna save it
02:23because if at any point you want to delete the application,
02:26you'll want to just delete this full folder.
02:30Same is true because two applications are being
02:32installed at the same time.
02:34Is that your NPM, which is something
02:37that we're gonna be the main focus of.
02:39This full chapter is also being installed
02:42and it's inside of your bin folder under NPM.
02:45Now, the remainder of the chapter really is going
02:47to be about end pm once we're done with installation,
02:51but I wanna make sure that everything is working.
02:53So I'm gonna click here on close.
02:56And what I'm gonna do is I'm gonna go into my terminal
02:58and what I want you to do is just type the words node space
03:02minus V, and you'll be able to get the version of node
03:05that is currently running in our case,
03:07because on our Mac that we're working with right now,
03:11we installed the latest current version, which is 6.2 0.1.
03:16Now I wanted to talk about one more thing.
03:18If you're running on Windows, just make sure,
03:20if you've just installed the CGU terminal, make sure
03:23to close it and then reopen it
03:26because if you had it remaining open when you type in Node
03:30V, you're gonna get an error.
03:31It's not gonna find it. But once you close the terminal
03:34and reopen it, you're gonna see
03:36that it's gonna give you back the version
03:37that's been installed on your operating system.
03:40So make sure if you're on Windows to reset your terminal,
03:43same is probably true on a on a Mac.
03:45But on a Mac you might have a different issue
03:48where your paths are not configured correctly.
03:51And we'll have a troubleshooting, um,
03:53documentation in the appendixes to this video.
03:57In this lecture, we saw how to set up node js and NPM
04:01and also talked about the differences
04:03between production and latest version.
04:06In the next lecture, we're gonna go ahead
04:07and take a look at the same process only this time around
04:11how do you do it on a real world server.
04:13So we're gonna SSH onto my server
04:16and we're gonna take a look at how do you install no JS
04:19and NPM.

Ready to Level Up Your Skills?

Join thousands of learners on 02GEEK and start your journey to becoming a coding expert today!

Enroll Now for Free!