npm-install icon indicating copy to clipboard operation
npm-install copied to clipboard

Cache hit- but still installs dependencies

Open dan-cooke opened this issue 2 years ago • 4 comments

I have not got round to debugging this - but every install takes around 50-60 seconds even with a cache hit.

Turns out its still running yarn install even after the cache has been restored? I'm assuming this is intentional, but just double checking?

I am scratching my head at how Vercel can have my app linted, built and deployed in about 30 seconds

running npm-install GitHub Action
trying to restore cached NPM modules
Received 213909504 of 1016025228 (21.1%), 202.8 MBs/sec
Received 507510784 of 10[16](https://github.com/baggers-org/baggers/actions/runs/4133267482/jobs/7143015069#step:7:17)025228 (50.0%), 241.2 MBs/sec
Received 834666496 of 1016025228 (82.2%), 264.7 MBs/sec
Received 1016025228 of 1016025228 (100.0%), 166.8 MBs/sec
Cache Size: ~969 MB (1016025228 B)
/usr/bin/tar --use-compress-program unzstd -xf /home/runner/work/_temp/629c9279-ec08-4380-a001-0102ec23681a/cache.tzst -P -C /home/runner/work/baggers/baggers
Cache restored successfully
npm cache hit yarn-linux-x64-0c361b3f98[17](https://github.com/baggers-org/baggers/actions/runs/4133267482/jobs/7143015069#step:7:18)54db7e96963a680976f4f1f0f44bf27fa237e37038447cfcbb00fab9bd840efc668af33fb9e06660f3f9de668a3e056a0360548c7e6a571c1c30
installing NPM dependencies using Yarn
yarn at "/usr/local/bin/yarn"
/usr/local/bin/yarn --frozen-lockfile
yarn install v1.22.[19](https://github.com/baggers-org/baggers/actions/runs/4133267482/jobs/7143015069#step:7:20)
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
[4/5] Linking dependencies...

dan-cooke avatar Feb 09 '23 10:02 dan-cooke

Sorry to "+1" but I'm also interested in whether it's expected to still run yarn install after a cache hit.

jamesonhill avatar Aug 02 '23 15:08 jamesonhill

@bahmutov another +1, this is surprising, can you provide context on this? Install step for me currently takes >1 min with a cache hit (>3 min with no cache hit) but could be ~seconds if we skip the actual install I believe.

mariaines avatar Aug 02 '23 17:08 mariaines

Facing the same issue here. image It's a small project and not taking too much time to install, but it still feels weird that it installs after a cache hit

ghost avatar Mar 17 '24 02:03 ghost

This caches the local npm cache, not your node_modules. After a cache hit, npm should install from the cached local npm cache instead of from an empty local npm cache. If you want to check if this is giving any gain, compare the time it takes to run this step without and with a cache hit.

ericbn avatar Jul 22 '24 16:07 ericbn