npm install packages from Github

Sagar Chauhan
2 min readMar 18, 2021

--

This quick guide shall help you install private packages from Github using npm.

Photo by Yancy Min on Unsplash

This guide is intended to help you set up your project to access and install private GitHub repositories into your project.

From your project’s root directory, run the following commands:

# Open a terminal and run (Below command is one single line and not two different lines)

npm config set @Kartmax-technology:registry https://npm.pkg.github.com/Kartmax-technology

# Log in to your GitHub account and visit the settings section and from the left sidebar find a tab called “Developer Setting”. Click on it.

# Here you shall find another tab called “Personal Access Token”, click it and then find a button called “Generate Token”, click on that as well. You shall find a screen similar to this.

# Generate a new access token here and copy it safely.

# Create a .npmrc file in your root directory and paste this line:

//npm.pkg.github.com/:_authToken=<auth-token>

That's it! Your npm config is now ready to install package from GitHub and npm packagist as well.

--

--

Sagar Chauhan
Sagar Chauhan

Written by Sagar Chauhan

Hustler | Geek | Bootstrapper | PolyMath

No responses yet