Sometimes you need a dependency that is not published as a regular package at npmjs.com. Probably is the case of a private package.
Node.js allows remote dependencies such as GitHub private repository, so let explain how to do that.
We will need a GitHub personal token. In your GitHub account go to
Settings–>Developer settings–>Personal access tokens.
After that, generate a new token with the permissions you need (probably read-only).
Your package.json will look like this:
"dependencies": {
"module-name": "git+https://TOKEN_FROM_GITHUB:x-oauth-basic@github.com/My-company/my-repo.git"
}
If you want to point to a specific branch add #your-branch at the end of the url so, /My-company/my-repo.git#your-branch
Remember to run npm install after you save the package.json file.