Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suggestion: cache downloaded chromium zip in user's cache directory #6215

Closed
AviVahl opened this issue Jul 13, 2020 · 5 comments
Closed

suggestion: cache downloaded chromium zip in user's cache directory #6215

AviVahl opened this issue Jul 13, 2020 · 5 comments
Assignees

Comments

@AviVahl
Copy link
Contributor

AviVahl commented Jul 13, 2020

(surprised I couldn't find an existing issue regarding this)

Puppeteer currently caches the extracted downloaded chromium folder at <project>/node_modules/puppeteer/.local-chromium.

Would be great if the zip file itself could be cached as well in the local user's cache directory (per revision).
Could use https://www.npmjs.com/package/cachedir to do that.

Having it in the user's cache will ensure different projects can reuse already-downloaded revisions and avoid the speed hit for cold installs.

@mathiasbynens
Copy link
Member

There are a few existing issues about this such as #679. I agree we should do this. We could perhaps install the browser binaries globally, in a ~/.puppeteer directory (configurable through an environment variable), with a unique path per exact revision.

@mathiasbynens mathiasbynens self-assigned this Jul 14, 2020
@Tony221268
Copy link

Yep, loving the wait of 10 minutes while puppeteer downloads chromium. Don't even use it but thanks for the coffee break.

@jsdevel
Copy link

jsdevel commented Aug 17, 2020

@mathiasbynens is there a way this can be moved forward? i prefer to use npm ci instead of npm i to avoid updates to package-lock.json and to ensure i am in sync. the issue (as others have mentioned) is that chromium must be downloaded again and again. would you accept a PR to allow an ENV var to change the download location? an env var would allow users to download the binary to any location. in my use case, anywhere outside of node_modules would allow me to have fast npm installs using npm ci.

@mathiasbynens
Copy link
Member

@jsdevel This was implemented in #6014. It'll be in the next Puppeteer release! Closing this issue.

@AviVahl
Copy link
Contributor Author

AviVahl commented Aug 17, 2020

While the environment variable is a nice step forward, it isn't quite what was requested here.

How would different repositories with (possibly) different puppeteer versions cache different chrome revisions using this approach? Would they override one another? are there revision-based sub directories?

The out-of-the-box behavior is also a key factor in my request. Having to configure each system with an environment variable (and let new users know about this) is an hassle on large teams.

I really believe this could be improved to the point where people would stop noticing these downloads without having to know anything about it. Just once per revision for each system(/user).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants