问题描述
背景
嗨,我有一个组织,在 Azure Devops 中有很多项目。其中一个项目创建了一个组织范围的提要,并构建了一些管道,将 NPM 发布到提要。我们现在可以看到包出现在提要中。然后我们按照“连接到提要”中的说明来恢复包。
.npmrc 文件
registry=https://pkgs.dev.azure.com/<yourOrganization>/_packaging/<yourFeed>/npm/registry/
always-auth=true
; begin auth token
//pkgs.dev.azure.com/<yourOrganization>/_packaging/<yourFeed>/npm/registry/:username=[ANY_VALUE_BUT_NOT_AN_EMPTY_STRING]
//pkgs.dev.azure.com/<yourOrganization>/_packaging/<yourFeed>/npm/registry/:_password=[BASE64_ENCODED_PERSONAL_ACCESS_TOKEN]
//pkgs.dev.azure.com/<yourOrganization>/_packaging/<yourFeed>/npm/registry/:email=npm requires email to be set but doesn't use the value
//pkgs.dev.azure.com/<yourOrganization>/_packaging/<yourFeed>/npm/:username=[ANY_VALUE_BUT_NOT_AN_EMPTY_STRING]
//pkgs.dev.azure.com/<yourOrganization>/_packaging/<yourFeed>/npm/:_password=[BASE64_ENCODED_PERSONAL_ACCESS_TOKEN]
//pkgs.dev.azure.com/<yourOrganization>/_packaging/<yourFeed>/npm/:email=npm requires email to be set but doesn't use the value
; end auth token
问题
我作为项目管理员可以成功恢复包(npm install)。但是,有些用户输入命令后无法恢复并显示“401未授权”。我已经检查了视图设置和 .npmrc 文件以及 PAT,包装范围很窄(读取和写入)。
我还检查了 Manage packages with feed permissions。它说列出、安装和恢复软件包只需要“读者”权限。我将用户添加到项目级别的读者组和订阅源设置中的读者组。
可能缺少什么?
更新 要分享我的管道详细信息:
trigger:
- main
pool:
vmImage: 'ubuntu-latest'
steps:
- task: Nodetool@0
inputs:
versionSpec: "10.x"
displayName: "Install Node.js"
- task: Npm@1
inputs:
command: "install"
workingDir: <Dir>
- task: Npm@1
inputs:
command: "publish"
workingDir: <Dir>
publishRegistry: "useFeed"
publishFeed: <Feed>