avatar
Filip Jerga
June 8, 2021

How To Setup an Npm Based Project From GitHub - Eincode

Wondering how to set up an npm project from Github using the git CLI and without it? This article breaks -down the new video lecture by Eincode and answers all your questions.

TODO: provide alt

As the largest and arguably most advanced development platform out there, GitHub enables millions of developers and companies across the globe to script, ship, and maintain their software without skipping a beat. In addition, GitHub’s suite of unlimited public and private repositories allow you to host your code for free. And lets you share the best community-approved projects on its platform with others, thanks to GitHub packages.

Given the gravity GitHub exercises over the programming world, seasoned and amateur software developers alike must know their way around the platform. Considering this, we’ve covered in detail the process of setting up a starting project from GitHub in this all-new video. Moreover, this video will also help you to access the source project files that we’ll be working upon in our future video lectures with ease.

Resources

Video guide: https://youtu.be/VgUng7isvlY

Checking Off The Prerequisites

Before we get started with the setting up process, there are some requirements that we need to install. They are listed below and discussed in [0:14] of the video.

  1. The first requirement is to have the Node.js environment in place.
  2. The process of installing the Node.js environment is rather straightforward. All you need to is open https://nodejs.org/en/ and download the LTS version.
  3. It would be best if you opted for the LTS version that is recommended for most users. Opting for LTS is because LTS release lines focus on extended support, stability and provide a reliable platform for all applications irrespective of their scale.
  4. Click on the link corresponding to the OS (Operating System) you’re using (macOS, Windows, or Linux).

Once the Node.js environment has been installed, we proceed with verifying it. To understand how you can verify the installation of Node.js, navigate to [1:14] of the video. It comprises the following steps -

  1. Open the “terminal” (macOS) or the PowerShell(windows) depending on the OS you’re using. Windows users who do not have Powershell by default may consider downloading Cmder, an equivalent console emulator.
  2. Once you’re in the terminal window, type in “node -v” to check for your node version.
  3. Additionally, you can also type in “npm -v” to check for the npm (node package manager) version, provided you have an npm in the first place.

Setup A Project From Github

Now that we are verifying our node installation, we can proceed with setting up our project. There are two ways to go about this.

The Optional Way — No Git CLI

The optional method of setting up a project has been discussed in [2:27] of the video. It comprises the following steps -

  1. This method involves setting up the project without installing a git CLI (Command-Line Interface). For this, you need to have a GitHub account.
  2. Please navigate to the repository that we have prepared for you for this video. This has been demonstrated in [3:38] of the video.
  3. Next, you should be able to spot a green “clone or download” button in your video. Once you’ve selected the version of your choice, you need to click on this green button. Then, finally, click on “Download ZIP”.
  4. Unzip the file and navigate to the folder using the terminal. [5:11] of the video demonstrates this.
  5. Type the command “npm install” in the terminal to install all the dependencies. Once the dependencies are installed, run the development server. Usually by typing commands “npm start” “npm run start-dev” or “npm run dev”, depending on the scripts in package.json file. To understand how to do this, refer to [5:50 of the video].
  6. Keep in mind that the application we downloaded has to run two servers. The fact that these two servers need to work simultaneously for this method to work successfully. [5:58] of the video explains how you can ensure this condition.

The Recommended Way — With Git CLI

The optional method of setting up a project has been discussed in [7:49] of the video. It comprises the following steps -

  1. To go about this method, you need to have a git CLI in place to communicate with the GitHub repository.
  2. To understand how to download git CLI, refer to [8:38] of the video. From the options available, select “binary installer”. The installation process of the git CLI is pretty much similar to that of the node.
  3. After git CLI is installed, type in “git version” in the terminal to check for your version as a means of verification.
  4. Now, navigate to the GitHub repository that was discussed previously. This time we’ll be using the clone feature of the “ clone or download” button.
  5. To use the clone feature, you first need to select the master version in the drop-down list that emerges from the “branch:master or branch:main” button. To understand this, refer to [11:13] of the video.
  6. Next, copy the link to the clipboard and, using the terminal specify the folder where you want to set up the project. This has been demonstrated in [11:46] of the video.
  7. In the terminal, paste your link to clone your project. [12:12] of the video explains how to do this.
  8. Once you’re in your project folder, type in “npm install” in the terminal. Then, run the dev and node API server as we had in the previous method.

The process of setting up the project is now complete.

Take The First Step

We live in a tech-savvy world where learning about the various technologies and algorithms that influence our lifestyles has become no longer a luxury but a necessity. With Eincode courses, take the first step towards discovering the fun world of programming and developing and give life to creations that make the world a better place. Beyond everything else, the goal of Eincode courses is to equip the developers and leaders of tomorrow with the necessary tools to shape their ideas and visions.