简体   繁体   English

用新的用户名和密码更新 vsts-npm-auth

[英]Update vsts-npm-auth with new username and password

I have installed the vsts-npm-auth package using following command:我已经使用以下命令安装了vsts-npm-auth package:

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

And I ran vsts-npm-auth -config.npmrc command to set the credential but I am facing below error:我运行vsts-npm-auth -config.npmrc命令来设置凭据,但我面临以下错误:

在此处输入图像描述

Now I need to update the credential but it always fetches the existing credential.现在我需要更新凭证,但它总是获取现有的凭证。 Is there any way to send PUT request and update the credential?有没有办法发送PUT请求和更新凭证?

I made it work with help of my colleague. 我在同事的帮助下使其工作。

  1. Uninstall vsts-npm-auth package 卸载vsts-npm-auth软件包
  2. remove NPM cache 删除NPM缓存
  3. delete .npmrc file under Users folder 删除Users文件夹下的.npmrc文件
  4. And re-run the below command with auth flag set to false. 并在auth标志设置为false的情况下重新运行以下命令。 It will ask for the creds. 它将要求信誉。

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

If the above solution is not working.如果上述解决方案不起作用。 I am adding a few more steps to the above answer我在上面的答案中添加了更多步骤

  1. Uninstall vsts-npm-auth package卸载 vsts-npm-auth 包

  2. remove NPM cache移除 NPM 缓存

  3. delete .npmrc file under Users folder //new steps删除用户文件夹下的.npmrc文件//新步骤

  4. https://github.com/Microsoft/azure-pipelines-tasks/issues/6733#issuecomment-376604435 As mentioned in the link remove the already existing token and details to show the login prompt again open regedit (windowsKey + R + type "regedit") delete -> HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\VSCommon\\14.0\\ClientServices\\TokenStorage\\VisualStudio\\VssApp https://github.com/Microsoft/azure-pipelines-tasks/issues/6733#issuecomment-376604435如链接中所述,删除现有的令牌和详细信息以再次显示登录提示打开 regedit (windowsKey + R + type " regedit") 删除 -> HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\VSCommon\\14.0\\ClientServices\\TokenStorage\\VisualStudio\\VssApp

  5. Restart your system重启你的系统

  6. And re-run the below command with auth flag set to false.并在 auth 标志设置为 false 的情况下重新运行以下命令。 It will ask for the creds.它会要求信用。

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

  1. vsts-npm-auth -config .npmrc
  1. Optional: Make a backup of your.npmrc file.可选:备份您的 .npmrc 文件。
  2. Edit the.npmrc file.编辑 .npmrc 文件。
  3. Delete the lines with the cached credentials.删除具有缓存凭据的行。 More specifically delete:更具体地说,删除:
  • Any line ending with username=VssSessionToken任何以username=VssSessionToken结尾的行
  • Any line starting with the comment ; This is an unencrypted authentication token.任何以注释开头的行; This is an unencrypted authentication token. ; This is an unencrypted authentication token.
  • Any line containing password=任何包含password=
  • Any line containing email=任何包含email=的行
  1. Save the file.保存文件。
  2. Run vsts-npm-auth -config.npmrc运行vsts-npm-auth -config.npmrc

Just run "vsts-npm-auth -F -config.npmrc"只需运行“vsts-npm-auth -F -config.npmrc”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM