npm install from tfs feed (on build process) give error: Unable to authenticate

一个人想着一个人 提交于 2019-12-23 09:49:41

问题


We have our own npm package and a project that uses it, I want to publish it to a tfs feed - repository and install it from there instead of from a physical file.

I published the package to the feed from my development machine,
and I changed the reference within the project that consumes it.

The whole process works fine from my machine, but when I try to consume the package on a build process in the tfs - it fails with the error :

Unable to authenticate, your authentication token seems to be invalid.

I've created .npmrc file at the project level with the registry address, and another file with credentials on the user directory, and I did the same on the TFS machine.

What can cause the npm install (from my feed) to not work on the tfs machine?

EDIT:
When I add prefix @my to the registry at the user-level .npmrc file - like this:

@my:registry=https://my-feed-address

The error changes to: "No valid versions available for my-package"


回答1:


  1. Install this in machine: npm install -g vsts-npm-auth
  2. Run this (in the directory where npmrc file is): vsts-npm-auth -config .npmrc



回答2:


Create a file .npmrc in your project folder and add the following

registry=Your URL
always-auth=true

In the command prompt run both of these commands

npm install -g vsts-npm-auth --registry https://registry.npmjs.com --always-auth false

vsts-npm-auth -config .npmrc



来源:https://stackoverflow.com/questions/56824651/npm-install-from-tfs-feed-on-build-process-give-error-unable-to-authenticate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!