William Lohan William Lohan - 1 year ago 103
Git Question

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?

Answer Source

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://git@github.com:<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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download