I'm trying to cache my npm packages in an Azure Pipeline YAML. I used this code from Microsoft: https://docs.microsoft.com/en-us/azure/devops/pipelines/release/caching?view=azure-devops#nodejsnpm
Here's part of my YAML file:
steps:
- task: NodeTool@0
displayName: 'Use Node 12.x'
inputs:
versionSpec: 12.18.3
checkLatest: false
- task: Npm@1
displayName: 'npm install'
inputs:
workingDir: WebApp
verbose: false
- task: Cache@2
inputs:
key: 'npm | "$(Agent.OS)" | package-lock.json'
restoreKeys: npm | "$(Agent.OS)"
path: $(npm_config_cache)
displayName: Cache NPM packages
When I run the pipeline it fails with this message:
A task is missing. The pipeline references a task called 'Cache'. This usually indicates the task isn't installed, and you may be able to install it from the Marketplace: https://marketplace.visualstudio.com.
I tried installing the Cache task from the Microsoft Marketplace but it wasn't available. I'm using Azure DevOps Server 2019 with the June update. The Cache task hasn't been deprecated and should work with my version of Azure DevOps Server according to this page: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/cache?view=azure-devops. How do I install the Cache task?
UPDATE:
I found a post on a Microsoft developer forum that covers the same issue: https://developercommunity.visualstudio.com/content/problem/1092245/cache-task-not-available-on-azure-devops-server.html. Apparently the Cache task is not currently available on Azure DevOps Server 2019. I'll have to look for a workaround. Talk about ridiculous. Microsoft doesn't make the Cache task available and puts nothing on their website about it.
CacheBeta@0
works? – Shayki Abramczyk