Member-only story
How to Not Need a Private npm Registry
npm install from a git repo
Have you found yourself like me scouring the internet for the cheapest easiest way to do something? I spent a few hours digging into finding a way to host, deploy, and install a package using npm but without using npm. I think I found the cheapest most elegant solution, and I hope you can benefit from what I’ve learned.
Here’s the short answer: Use a Git repository. It really doesn’t matter which one you use. But it can even be a repository that isn’t public.
The nice thing about using npm to manage your packages is that you can install everything with one command along, and it’ll only give you the files that you need to import.
The steps to complete this are as follows.
- Create a Git repository (in this case, mine is in GitHub)
- Run
npm init
on that repo - Configure your
package.json
- Configure
package.json
in a separate application to point to that repo
I'm going to skip a few steps here because I'm going to assume you know how to do some of these.
I'll skip to showing you what my package.json
looks like.