We are using GitLab for our private project. There are some forked libraries from github, that we want to install as npm module. Installing that module directly from npm is
Update
As @felix mentioned in comments (thanks @felix) using deploy token is much more relevant for reading a private registry on gitlab. This way is the token is compromised, attacker just can read that repository and cannot make changes.
Creating a Deploy Token
GitLab account.Expand on Deploy Tokens section.read_repositoryOld answer
Goto User Settings > Access Tokens and create a new access token with read_registry permission.
Copy generated token, we need it for our package.json file.
Now in package.json add the dependency as below:
"my-module": "git+https://Xaqron:token@gitlab.com/Xaqron/my-module"
Replace Xaqron with your username and token with the generated token. You can specify branch and tag at the end of url by #{branch|tag}.
Note: Since access token is located in package.json anyone who has access to this project can read the repository, so I assume your project is private itself.