Cloudflare DevelopersCD
Cloudflare Developersβ€’8mo agoβ€’
46 replies
fforres

PNPM cache not working on Workers build

Have not been able to make caching work for pnpm in workers build. Couple of issues I found:

Confusing docs:


- looking at the docs it states that the caching folder for pnpm is .pnpm-store
- When outputting the location using pnpm store path it says it is /opt/buildhome/.local/share/pnpm/store/v3

Forcing a location still downloads files

Tried debugging it by:
- Setting SKIP_DEPENDENCY_INSTALL true (I can see it working)
- Set manually a cache location pnpm config set store-dir ~/.pnpm-store (Validated it is set with an echo before and after)
- Set script to manually install Manually run pnpm install --prefer-offline
- Blasted the build cache
- Run a couple of builds to populate cache.

I'd expect the output of CI to be something like:
- Progress: resolved 2476, reused 2459, downloaded 0, added 2476, done
(Notice the downloaded 0)
- Still seeing:
10:19:31.321    ../..                                    | Progress: resolved 2488, reused 0, downloaded 2393, added 2380
10:19:32.322    ../..                                    | Progress: resolved 2488, reused 0, downloaded 2406, added 2395
10:19:33.322    ../..                                    | Progress: resolved 2488, reused 0, downloaded 2469, added 2470
10:19:34.036    ../..                                    | Progress: resolved 2488, reused 0, downloaded 2471, added 2488, done

- Even when running this a couple of time with the same build-command

Not sure what heuristic is used for caching (I imagine pnpm-lock.yaml ? Would be great to know that πŸ™ )

No build system options on workers setting


- On the docs, I see a section for v2 to v3 Migration (here)
- Thought this might be the case. But could not find that option anywhere on my workers.




----

FWIW ...I'm using this in a mono-repo setup with a pnpm-workspace.yaml file
Was this page helpful?