[Slidev] 解决Slidev export导出pdf报错
解决Slidev export导出pdf报错
问题
按照Slidev的官方文档使用导出为pdf需要安装playwright-chromium
官网安装方法如下:
npm i -D playwright-chromium
在我电脑上执行安装后直接执行导出命令sudo slidev export
,显示报错如下:
Slidev v0.42.1 (global)
theme @slidev/theme-default
css engine unocss
entry /home/jyb/test/slides.md
Error: The exporting for Slidev is powered by Playwright, please install it via `npm i -D playwright-chromium`
at exportSlides (/usr/lib/node_modules/@slidev/cli/dist/export-PN4EOI4Z.js:127:11)
at Object.handler (/usr/lib/node_modules/@slidev/cli/dist/cli.js:342:28)
原因
因为我安装Slidev的时候就是使用sudo npm i -g @slidev/cli
全局安装,所以playwright-chromium也应该全局安装。
解决办法
sudo npm i -g -D playwright-chromium