VSO
VSO

Reputation: 12646

How Do I Install Specific Git Branch Using NPM?

I am using Angular 2 Google Maps in my project. Someone created a branch that has the functionality I need. I would like to npm i that branch instead of master. I found a question telling me how to do it here (Install specific branch from github using Npm), which recommends the following format:

npm install git://github.com/shakacode/bootstrap-loader.git#v1 --save

So I tried:

npm i git://github.com/SebastianM/angular-google-maps.git#add-clustered-markers --save
npm i git://github.com/SebastianM/angular-google-maps.git#inovex:add-clustered-markers --save

I get the following error:

npm ERR! Command failed: git -c core.longpaths=true rev-list -n1 add-clustered-markers
npm ERR! fatal: ambiguous argument 'add-clustered-markers': unknown revision or path not in the working tree.
npm ERR! Use '--' to separate paths from revisions, like this:
npm ERR! 'git <command> [<revision>...] -- [<file>...]'

The docs don't seem to cover installing branches. From the error, it seems that I need to specify the revision number somehow, I can't find information on how to do that.

TL;DR: How do I npm i a specific repo branch.

Upvotes: 3

Views: 8385

Answers (1)

BogdanC
BogdanC

Reputation: 2784

Maybe because that branch does not exist in the specified project.

enter image description here

Upvotes: 3

Related Questions