Closed
Description
Required Information
Entering this information will route you directly to the right team and expedite traction.
Question, Bug, or Feature?
Type: Bug
Enter Task Name: CacheV2 (https://github.com/microsoft/azure-pipelines-tasks/tree/master/Tasks/CacheV2)
Environment
-
Server - Azure Pipelines
- Account name: markethype
- Team project name: MarketHype
- Build ID: 1563
- URL: https://dev.azure.com/markethype/MarketHype/_build/results?buildId=1563
-
Agent - Hosted:
- Agent Queue name: Azure Pipelines (https://dev.azure.com/markethype/MarketHype/_settings/agentqueues?queueId=17&view=jobs)
Issue Description
Using the CacheV2 task to cache Yarn packages, we're getting an error in the post-job step of the cache task.
The task is defined exactly as in the docs.
variables:
YARN_CACHE_FOLDER: $(Pipeline.Workspace)/.yarn
steps:
- task: Cache@2
inputs:
key: 'yarn | "$(Agent.OS)" | yarn.lock'
restoreKeys: |
yarn | "$(Agent.OS)"
path: $(YARN_CACHE_FOLDER)
displayName: Cache Yarn packages
We're using the vs2017-win2016
image.
Error logs
Starting: Cache Yarn packages
==============================================================================
Task : Cache
Description : Cache files between runs
Version : 2.0.0
Author : Microsoft Corporation
Help : https://aka.ms/pipeline-caching-docs
==============================================================================
Resolving key:
- yarn [string]
- "Windows_NT" [string]
- common/config/rush/yarn.lock [file] --> 0551FA989D7CDCB2101F1397E8E7C5468396D4C72935548B6A74BEB126F0296F
Resolved to: yarn|"Windows_NT"|57F7K6kT3NtH/ZuSuWsxueTn4wCxuYls973WEnqCJgE=
Information, ApplicationInsightsTelemetrySender will correlate events with X-TFS-Session 06101a50-81b0-41b6-ab13-b130ee5c98ae
Information, Getting a pipeline cache artifact with one of the following fingerprints:
Information, Fingerprint: `yarn|"Windows_NT"|57F7K6kT3NtH/ZuSuWsxueTn4wCxuYls973WEnqCJgE=`
Information, There is a cache miss.
tar: D\:\\a\\1\\.yarn: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
Information, ApplicationInsightsTelemetrySender correlated 1 events with X-TFS-Session 06101a50-81b0-41b6-ab13-b130ee5c98ae
##[error]Process returned non-zero exit code: 2
Finishing: Cache Yarn packages
Activity
jmaragon commentedon Jun 10, 2020
Same issue here, but this time with npm
Starting: Cache npm
Task : Cache
Description : Cache files between runs
Version : 2.0.1
Author : Microsoft Corporation
Help : https://aka.ms/pipeline-caching-docs
Resolving key:
Resolved to: npm|"Windows_NT"|2DZ3WcfStD108j8qipq/0v97TF5eyy6fpvtPYfpDrZM=
Information, ApplicationInsightsTelemetrySender will correlate events with X-TFS-Session xxxxxxxxxx-1282-485c-a6f4-b92a59ed4955
Information, Getting a pipeline cache artifact with one of the following fingerprints:
Information, Fingerprint:
npm|"Windows_NT"|2DZ3WcfStD108j8qipq/0v97TF5eyy6fpvtPYfpDrZM=
Information, There is a cache miss.
tar: Cannot change to directory E:\Agents\3\283\s\node_modules: No such file or directory
tar: Error is not recoverable: exiting now
Information, ApplicationInsightsTelemetrySender correlated 1 events with X-TFS-Session XXXXXXXX282-485c-a6f4-b92a59ed4955
##[error]Process returned non-zero exit code: 2
Finishing: Cache npm
bradringel commentedon Jun 10, 2020
Same issue here on a hosted linux agent
stevewarsa commentedon Jun 19, 2020
Same issue here with yarn - it is in some autogenerated task after my WAR deploy is done - the task is called "Post-job: Cache":
tar: /blah/blahgent/_work/1/s//node_modules, !/node_modules/**/node_modules: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
Information, ApplicationInsightsTelemetrySender correlated 1 events with X-TFS-Session 18de2057-e96c-4ff9-9091-595b9595f5cf
##[error]Process returned non-zero exit code: 2
Finishing: Cache
Any clue how to solve?
lesterchan commentedon Jun 24, 2020
Came in here to +1 to this, below is my config:
Post-job: Cache Yarn Packages
will throw an errorjfheins commentedon Aug 4, 2020
For me it works, but I have set the directory directly because I found no suitable pipeline variable:
I'm using a hosted agent (ubuntu-18.04); maybe this works for you as well.
One can print the relevant directory for yarn with
yarn cache dir
jotatoledo commentedon Aug 5, 2020
@jfheins thanks for the hint.
Current configuration works for me in cloud-hosting:
github-actions commentedon Feb 1, 2021
This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days
bradringel commentedon Feb 2, 2021
Bumping because this is still happening and I don't think it should be closed
28 remaining items
DxTa commentedon Jun 17, 2024
@nickshanks347 's comment is really helpful. In deed, the same also happening to other tool such as pip
Evanion commentedon Aug 27, 2024
I tried
But I get
I would expect the post-job to create the folder if it doesn't exist.
jfheins commentedon Aug 29, 2024
The output is telling you that the directory with the stuff you want to cache does not exist. (i.e. there is nothing to cache)
Have you tried to run
npm --global cache verify
in the pipeline to have npm output the cache directory?AlexisJacob1 commentedon Oct 7, 2024
Hi,
We're having the same issue, but with NuGet packages.
Can we have an update on this ?
By the way, I agree with @Evanion when he say:
jfheins commentedon Oct 9, 2024
With nuget, the process to get it working is the same:
dotnet nuget locals all --list
within the pipeline)Optional: Check what pipeline variables exist and maybe you can replace part of the absolute path with a variable
github-actions commentedon Apr 10, 2025
This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days