Wilhelmina Lohan
Wilhelmina Lohan

Reputation: 3043

Can you `npm install` from Team Services git repo?

I can successfully

git clone https://[org].visualstudio.com/_git/[repo]  

but if I run

npm install https://[org].visualstudio.com/_git/[repo] --save  

I get

npm ERR! fetch failed https://[org].visualstudio.com/_git/[repo]  
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 203  

Is it possible to install npm packages from Team Services git repos like you can from github?

Upvotes: 1

Views: 3148

Answers (2)

Steve Brush
Steve Brush

Reputation: 1

If you want to install a specific branch, you can run:

npm install git+https://[org]@dev.azure.com/[org]/Products/_git/[repo]#[branch]

Upvotes: 0

peteb
peteb

Reputation: 19428

If you want to install a package from a specific Git repo you need to structure the URL as follows, notice that the url is prepended with git+https://

npm i --save git+https://[org].visualstudio.com/_git/[repo]

This will also work if you want to install your repo over ssh

npm i --save git+ssh://[email protected]:<owner>/<repo>

You can add these style repo URL's to your package.json dependencies as well

"dependencies": {
  "custom-pkg": "git+https://[org].visualstudio.com/_git/[repo]"
}

You can read more about the different ways to install directly from git with npm in the npm install docs

Upvotes: 10

Related Questions