1

I've created an NPM Package on TFS (because my organisation uses TFS instead of normal git/gitbucket/gitlab), that I want to install to other projects.

On Github all I needed to do this was:

$ npm install git.com/username/privateRepoName        

but when I try:

$ npm install tfs.organisationname.net/reponame

I get the following error:

npm ERR! code E401

npm ERR! Unable to authenticate, your authentication token seems to be invalid.

I've tried multiple methods for hours now on adding my credentials (yes, my windows credentials are the same as my TFS credentials) but i'm not seeming to win nor find the answer anywhere as every example is using git credentials and not TFS.

Does anyone know how I can do this?

Community
  • 1
  • 1
Tumi
  • 41
  • 11

2 Answers2

0

npm install xxx can be seen as a shorthand for modifying package.json, where dependencies can be precised in four ways, as per the docs:

  • version range: "foo": "^1.0.0"
  • URL: "foo": "https://url.to/the/tarball/of/foo"
  • git URL: "foo": "https://url.to/foo.git"
  • github: "foo": "github-username/foo"
  • local path: "foo": "file:./path/to/the/foo/package"

NPM has built-ins for using private git repos as dependencies, but nothing for TLS.

Luckily, it provides a local path installation which will save you. Simply get the package locally, which you're able to do, make it a local dependency, and you're good to go.

Nino Filiu
  • 16,660
  • 11
  • 54
  • 84
0

The best way to tackle this since I have the rights to the TFS repository was to clone it then link it.

First $ git clone tfs.foo.com/repo into the project directory then read this doc.

Tumi
  • 41
  • 11