Published 2022-06-29
Trying to install the scoped/private GitHub package that you deployed?
Here we will talk about the setup required to install the private GitHub package.
There are some prerequisites that you have to set up prior to installing the package.
Remember to copy the PAT
to somewhere and save it. Because you wouldn't be able to retrieve them afterward.
Below is the step-by-step guide.
.npmrc
Firstly, create the .npmrc
in your Node project if you haven't. Paste the following template into your .npmrc
.
@OWNER:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=@TOKEN
Replace the @OWNER
with the scoped name. This is the Github username. In my case, it would be @tlcheah2
.
Then, replace the @TOKEN
with the Github Personal Access Token that you have created in the Prerequisites section.
Now, you have configured the .npmrc
correctly. Let's verify by installing the package.
npm install @tlcheah2/sample-publish-github-package
The package now should be installed successfully.
I hope this post does provide value to you and see you in the next one.
Thank you.