Azure 管道缓存任务出现“API 资源位置未注册”错误

mda*_*y77 6 npm azure-devops azure-pipelines

我正在尝试使用 Azure Pipelines 中的缓存任务来缓存我的 npm 依赖项。我正在使用 Azure DevOps Server 2020。当管道运行时,我收到以下错误消息:

Resolving key:
 - npm                          [string]
 - "Windows_NT"                 [string]
 - Web/package-lock.json [file] --> 118CDFE1CFD866ABF2489C955D015ED5D2962A76602B6B544D996C46B84
Resolved to: npm|"Windows_NT"|1C9oHznmI3rlvpEvjwhi+Ssx/V05b9WttZRq
Resolving restore key:
 - npm          [string]
 - "Windows_NT" [string]
Resolved to: npm|"Windows_NT"|**
Information, Getting a pipeline cache artifact with the following fingerprint: `npm|"Windows_NT"|1C9oHznmI3rlvpEvjwhi+Ssx/V05b9WttZRqxHYD+2w=`.
##[error]API resource location a7c78d38-31a8-417e-ba6b-7e58b352f304 is not registered on https://[azure_devops_url]/DefaultCollection/.
Run Code Online (Sandbox Code Playgroud)

这是我的管道 YAML 的一部分:

variables:
    npm_config_cache: $(Pipeline.Workspace)/Web/.npm
steps:
  - task: NodeTool@0
    displayName: 'Use Node 14.15.0'
    inputs:
      versionSpec: 14.15.0
      checkLatest: false
  - task: Cache@2
    displayName: 'Cache NPM packages'
    inputs:
      key: 'npm | "$(Agent.OS)" | Web/package-lock.json'
      restoreKeys: |
        npm | "$(Agent.OS)"
      path: $(npm_config_cache)
  - script: npm ci
Run Code Online (Sandbox Code Playgroud)

我将 npm 包安装在子文件夹中。我该如何解决该错误?

Krz*_*tof 6

It looks that this is not supported on premises. Please check this GitHub issue.

  • 难以置信。微软明确表示缓存任务在 Azure DevOps Server 2020 中可用,但实际上并不起作用。 (3认同)
  • 谢谢您的帮助。我对微软很失望。这并不是第一次他们的文档说某个功能在特定版本的 DevOps Server 中可用,但实际上并不可用。 (3认同)
  • 这实际上是我本周尝试使用的官方文档中记录为在 DevOps Server 2020 中工作的第三个功能,但发现它不受支持并且文档不正确。事实上,它不受支持已经够令人沮丧的了,但事实上,文档引导你进行疯狂的任务鹅追逐是疯狂的。 (3认同)
  • 这确实很奇怪。问题是新的(18天前),所以我怀疑有人在那里提出了错误的答案。可能是文档中的错误。@mdailey77 如果我的回复对您有帮助,您可以考虑投票吗? (2认同)