As awesome as the npm repository is, we don't want to push everything we do through their service. This is especially true for internal development teams who cannot publish their code for all the world to see. While you can rent or install a private npm repository, there's another way. Packages can be installed from other locations. Details about this are in npm help package.json in the dependencies section. Some examples are:
- URL: You can specify any URL that downloads a tarball, that is, a .tar.gz file. For example, GitHub or GitLab repositories can easily export tarball URL. Simply go to the Releases tab to find them.
- Git URL: Similarly, any Git repository can be accessed with the right URL. For example:
$ npm install git+ssh://user@hostname:project.git#tag --save
- GitHub Shortcut: For GitHub repositories you can list just the repository specifier, such as expressjs/express. A tag or a commit can be referenced using expressjs/express#tag-name.
- Local filesystem: You can install from a local directory using a URL like this: file:../../path/to/dir.