question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Keep getting yarn cache is not found

See original GitHub issue

Description: Using yarn 1, continue getting yarn cache is not found on PRs that have run multiple times. Weirdly, this works on pull_request but not on push events.

Push:

Run actions/setup-node@v2
Found in cache @ /opt/hostedtoolcache/node/16.13.2/x64
/usr/local/bin/yarn --version
1.22.17
/usr/local/bin/yarn cache dir
/home/runner/.cache/yarn/v6

yarn cache is not found

Pull request:

Run actions/setup-node@v2
Found in cache @ /opt/hostedtoolcache/node/16.13.2/x64
/usr/local/bin/yarn --version
1.22.17
/usr/local/bin/yarn cache dir
/home/runner/.cache/yarn/v6
Received 151904393 of 156098697 (97.3%), 144.9 MBs/sec
Received 156098697 of 156098697 (100.0%), 128.6 MBs/sec
Cache Size: ~149 MB (156098697 B)
/usr/bin/tar --use-compress-program zstd -d -xf /home/runner/work/_temp/1233a9f5-f0f9-47e9-aaf5-472904875c75/cache.tzst -P -C /home/runner/work/alchemist/alchemist
Cache restored successfully

Cache restored from key: node-cache-Linux-yarn-c29c2173f71392ee46ad40a81d3756710c14774844267556986d4379721c0e46

Action version: @2

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version: yarn 1

Repro steps:

name: Testing

on:
  push:
    branches:
      - '*'
  pull_request:
    types: [assigned, opened, synchronize, reopened, labeled]

jobs:
  testing:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
      - name: Use Node.js
        uses: actions/setup-node@v2
        with:
          node-version: '16'
          cache: 'yarn'
      - name: Install dependencies
        run: yarn install

Expected behavior: Should cache on both push and pull request events

Actual behavior: Only caches for pull request

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dmitry-shibanovcommented, Jan 26, 2022

Hello @mmahalwy. I can suppose two things:

  • It can be related to the cache-scope.
  • It can be related to the constant updating of the yarn.lock file, because the yarn install command can update dependencies. It updates the yarn.lock file and regenerate hash.
0reactions
mmahalwycommented, Feb 7, 2022

ty

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to cache yarn packages in GitHub Actions - Stack Overflow
Solution 3: Caching node_modules with actions/cache (NOT recommended) · yarn is good at utilizing global cache. If the dependencies are already ...
Read more >
`yarn cache clean` | Yarn - Package Manager
yarn cache clean. Remove the shared cache files. Usage. $> yarn cache clean. Examples. Remove all the local archives : yarn cache clean....
Read more >
Yarn caching doesn't work - Visual Studio Feedback
This could result in the task failing when this “file” does not exist. Please check if the “YARN_CACHE_FOLDER” variable is valid. You also...
Read more >
Using modern Yarn for deployment with Node.js on Azure App ...
Or, if .yarn\cache does not exist, set yarn to the latest version (3.x) and install. Both scenarios should produce no ...
Read more >
How to clear the cache in Yarn - Reactgo
In this tutorial, we are going to learn about how to clear or remove the cache in yarn. When we install a new...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found