Home > Enterprise >  NPM dependency from Gitlab directly
NPM dependency from Gitlab directly

Time:08-26

I have a situation where there was an update in one of npm packages I use in my project, but author didn't publish it on npmjs registry, so up to date code sits in gitlab only.

What would be the best solution to get updated version of code? I believe there is a way to add dependency to project which will be downloaded from gitlab or github public repository directly? Is it possible to compile it like in npmjs as well?

CodePudding user response:

Yes, you could install a dependency from a git repository directly. As can be seen in the npm docs. You can straight install a Git Remote repository like this:

npm install <git remote url>
e.g.
npm install git://github.com/npm/cli.git

But beware that installing directly from the source git might have unintended side effects (missing build files, additional documentation files in general changes to the npmjs Version). Also installing from the repository I would recommend you install from a specific commit/Tag.

  • Related