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
can not export to pdf #116
Comments
Can't reproduce, what's the content of your slides, does it do with any web requests? |
I have the same error with the default install : cf : https://fr.sli.dev/guide/#creation-de-votre-premiere-presentation OS : Windows |
May be caused by unreachable internet connetion, when rendering with some plugins. |
How did you turn on a global proxy? I have the same timeout issue, when running the build ... export to PDF works fine @antfu Is it possible to increase the timeout a bit? |
$ slidev export --timeout 3000 You can also try to disable the remote assets downloading ---
remoteAssets: false
--- |
I already have the remoteAssets: false :) ... But sometimes it runs into the timeout .. so no idea why |
Same problem with macOS 10.15.7, node 16.2.0, npm 7.14.0, and the latest slidevjs 0.15.0. I have set When I tried to run |
Might due to the Twitter scripts (was 'sync' loading). Changed to |
Hi @antfu : I tried v0.16.0 out, however, the issue is not yet fixed.
|
@madlogos Can you share your project? |
It's slow to access some foreign resources in some coutries, so a network proxy for low latency is required to meet the timeout limitation. |
Have u tried to set a higher timeout? |
I used exactly the built-in demo. When I applied global proxy to override GFW, the build action succeeded. So it's quite clear that the blocked internet component (twitter widget.js or even something on raw.githubusercontent.com) stopped the script. Maybe consider increasing the exception tolerance to let it go? Plus, twitter widget.js is injected into index.html by default. Maybe change it to optional (not included at all unless a Tweet widget is used)? |
Only when you use
I don't know. I don't think it makes sense to export the slides with some images / content failed to load. But maybe we could improve the error log to show the pending resources that causes the failing. |
So how can I remove twitter widgets.js from the slides? I removed all the widgets from the demo slides.md, but still had https://platform.twitter.com/widgets.js in the page rendered. |
The demo deck has more in the way of remote assets than just twitter. The unsplash backgrounds, sli.dev logo images used in the animation, etc. When you view these in the browser (dev or build mode), you use your browser's normal proxy. When you try to export to PDF, it uses the headless playwright/chrome package, which doesn't. Looks to me like the export launch command (https://github.com/slidevjs/slidev/blob/main/packages/slidev/node/export.ts#L76) should be modified to take a proxy in as an option (https://playwright.dev/docs/api/class-browser/#browser-new-context) . But, not sure how sli.devs would prefer to do it... front matter option? slidev cli option? |
Probably cli options if we want to have proxy config |
I also run into this issue and after I turned off my proxy, it still fails... |
I just turn the monaco editor config to false, and everything works :) |
I met the same issue as mentioned by @mariomurrent-softwaresolutions . |
PR welcome :) |
this error always occurs when playwright first time goto the page and the page is still building slidev/packages/slidev/node/export.ts Lines 97 to 99 in 209dd41
in my case, fixed by adding the timeout option instead of using await page.goto(url, {
timeout: timeout,
waitUntil: 'networkidle',
}) playwright docs says
|
@yanyongyu now you can set the timeout value for |
LGTM |
Add proxy to playwright. node_modules@slidev\cli\dist\export-LOKLMK66.js 67: const browser = await chromium.launch({
proxy: {
server: 'http://127.0.0.1:7890'
}
}); |
I've experienced the same, maybe can try to put the .md file and public resources under the (children) directory where the node.exe is installed. |
Can reproduce on Ubuntu 22, it's totally random though. Using a short timeout is better, as retrying fixes the issue most often. So it seems that if it should fail, it will fail, and if it should not, it quickly export. Feels like a connection fails and then the export is doomed to fail whatever the timeout does. |
So I have also hit this issue with a variety of presentations. I can't tell whether they are because of the high number of slides or whether it's because they use other things such as the I also got this error when running
Anything I can do to help debug this or test anything out? Thanks, |
@yonkeltron there is a default timeout in playwright when it waits for the "networkidle" event. |
Yes that timeout issue is definitely present when trying to Anything else I can do to provide more info? |
Disabling monaco for production and setting |
is also useful for me 🧓 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I try to use
npx slidev export
to export pdf, but it always fails on:The text was updated successfully, but these errors were encountered: