simonhaenisch / md-to-pdf

Hackable CLI tool for converting Markdown files to PDF using Node.js and headless Chrome.
https://www.npmjs.com/md-to-pdf
MIT License
1.2k stars 110 forks source link

bug: highlight.js broken on Vercel #121

Closed codingwithdidem closed 2 years ago

codingwithdidem commented 2 years ago

Locally converting from markdown to html and pdf works perfectly but when I deploy on Vercel Highlight css files are not found .

I defined tokyo-night-dark as the highlight style and its working locally

Screen Shot 2022-04-17 at 20 12 35

but on production with vercel I got this error :

Screen Shot 2022-04-17 at 20 08 48
simonhaenisch commented 2 years ago

Nice, I didn't even know it's possible to run this on Vercel.

I just did a local ls node_modules/highlight.js/styles and I don't actually see any tokyo-night-dark.css there, so probably you have a newer version of highlight.js installed locally? Just checked and that color scheme is not in 11.3 but appears to be in 11.5.

It might be due to the fact that you use a different npm version locally, or maybe Vercel uses npm ci which installs exactly what's pinned in package-lock.json. Vercel doesn't offer Node 16 yet, and Node 14 comes with npm 7 not 8. Maybe you can solve this though by deleting your package-lock.json, then running npm install again, and pushing the changes of the package-lock.