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.

Dependencies are still installed after cache flag is true

See original GitHub issue

Description: Yarn still installs dependencies even though cache flag is true. Tested on hosted ubuntu-latest env and on self-hosted macOS env.

Action version: Specify the action version actions/checkout@v2

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version:

yarn v1.22.15

Repro steps:
A description with steps to reproduce the issue. If your have a public example or repo to share, please provide the link.

name: unit-tests
on:
  workflow_dispatch

jobs:
  test:
    name: Cache deps
    runs-on: ubuntu-latest

    steps:
      - name: Checkout mobile-react
        uses: actions/checkout@v2

      - name: Set up Node with cache
        uses: actions/setup-node@v2
        with:
          node-version: 14
          cache: 'yarn'

      - name: Install yarn dependencies
        timeout-minutes: 5
        run: yarn install

Expected behavior: After cache is applied yarn install should be skipped.

Actual behavior: After cache is applied yarn installs dependencies Screenshot 2021-10-18 at 17 18 07 .

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
akmjenkinscommented, Dec 3, 2021

the action will save global cache for yarn or npm.

AHHHH, now I got it. This is why it still takes 40 seconds or so. The modules are all cached (when I specified cache: 'yarn', but they’re in the global cache, yarn still needs to fetch them (but it won’t go online, it’ll find them from the global cache) and resolve them to the local node_modules folder.

Thank you so much for spelling this out for me 🙏🏼 🙏🏼 🙏🏼

0reactions
dmitry-shibanovcommented, Dec 3, 2021

Hello @akmjenkins. Hosted images have precached versions of Nodejs. If version does not exist on the image, it will be downloaded and precached. If you use self-hosted runners Nodejs versions will be saved. Hosted runners are cleaned at the end of the job, so saved nodejs versions won’t be saved for future runs. If you specify npm or yarn, the action will save global cache for yarn or npm. The cache for yarn and npm is located in different places.

  • For yarn the action uses these commands: yarn cache dir (yarn 1) and yarn config get cacheFolder (other versions)
  • For npm the action uses this command: npm config get cache
  • For pnpm the action uses this command: pnpm store path
Read more comments on GitHub >

github_iconTop Results From Across the Web

`npm install` installs all dependencies of my project over the ...
To install the packages from the cache force, you can use the following way: $ npm --cache-min 9999999 install.
Read more >
Caching in GitLab CI/CD
Use cache for dependencies, like packages you download from the internet. Cache is stored where GitLab Runner is installed and uploaded to S3...
Read more >
pnpm install
Only devDependencies are installed and dependencies are removed insofar they were already installed, regardless of the NODE_ENV . --no-optional​.
Read more >
Super fast npm install on Github Actions - De Voorhoede
A guide to speed up installing Node.js dependencies in a CI environment. ... GitHub cache is still used as the base for a...
Read more >
Configuration options | Yarn - Package Manager
If true, Yarn will refuse the change the cache in any way (whether it would ... set it on your CI by manually...
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