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.

Yarn restores cache, but does not install from it

See original GitHub issue

Hey team!

First, awesome job on this feature, it will immensely help our CI speed for our JavaScript projects, kudos!

I’ve been running on the “over the limit” error for a yarn project with workspaces enabled:

Post job cleanup.
/bin/tar -cz -f /home/runner/work/_temp/3c08f6f0-f11f-4d8f-bed5-d491e7d8d443/cache.tgz -C /home/runner/.cache/yarn .
##[warning]Cache size of 231440535 bytes is over the 200MB limit, not saving cache.

But when I run the same tar command locally, I get a 100.3 MB bundle. Is there anything I’m missing here?

Here’s my workflow:

name: Test
on:
  push:
    branches:
      - '**'
    tags:
      - '!**'
jobs:
  test:
    name: Test, lint, typecheck and build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@master
      - name: Dump GitHub context
        env:
          GITHUB_CONTEXT: ${{ toJson(github) }}
        run: echo "$GITHUB_CONTEXT"
      - name: Use Node.js 10.16.0
        uses: actions/setup-node@v1
        with:
          node-version: 10.16.0
      - name: Cache yarn node_modules
        uses: actions/cache@v1
        with:
          path: ~/.cache/yarn
          key: ${{ runner.OS }}-yarn-${{ hashFiles('**/yarn.lock') }}
          restore-keys: |
            ${{ runner.os }}-yarn-
      - name: Install
        run: yarn install --frozen-lockfile
        # ...

Thanks a lot!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
glambertcommented, Nov 6, 2019

@teohhanhui to be confirmed, we only use yarn so I can’t tell. I’d say this is the subject for another issue.

In any case, yarn caching works to an extent here, so I’ll close this issue. Thanks again for your help @joshmgross 👍

1reaction
joshmgrosscommented, Nov 5, 2019

You can definitely use a node_modules in your cache instead of caching the yarn cache directly, that’s how we handle caching with npm (npm has a cache but it’s not meant to be populated by the user).

I’d recommend trying it out and seeing which is faster

Read more comments on GitHub >

github_iconTop Results From Across the Web

"yarn global add" doesn't globally install packages ...
yarn -cache. Run a build and then run it again (make sure in the "Restore cache" step that home/ubuntu/.yarn-cache is ...
Read more >
setup-node restoring cache but still takes a while to yarn
The built-in cache of setup-node puts the installed packages in the global cache for the package manager used (yarn or npm).
Read more >
Yarn cached install slow - Caching Dependencies
The solution to this first issue was due to installing yarn after restoring the cache. We were installing a version of yarn that...
Read more >
Janic
Finally managed to properly cache yarn workspaces in github actions. Got install time down from 4mins to < 1 min when cached (basically...
Read more >
Why isn't my build using the cached node modules?
If you are here to create a ticket for restoring databases deleted as a result ... it will run yarn install and use...
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