neocotic / convert-svg

Node.js packages for converting SVG into other formats using headless Chromium
MIT License
200 stars 47 forks source link

Support node 16 (update puppeteer) #100

Open rsodre opened 1 year ago

rsodre commented 1 year ago

I'm reusing my SVG to PNG code that is battle tested on an old (2021!) project, but when deploying to Vercel, I get this error calling the endpoint:

2022-12-21T02:15:00.609Z    9e2b2872-6888-4569-b0e6-0befd516db2d    ERROR   Error: Could not find expected browser (chrome) locally. Run `npm install` to download the correct Chromium revision (982053).
    at ChromeLauncher.launch (/var/task/node_modules/puppeteer/lib/cjs/puppeteer/node/Launcher.js:105:23)
    at async Converter.[getPage] (/var/task/node_modules/convert-svg-core/src/Converter.js:364:24)
    at async Converter.[convert] (/var/task/node_modules/convert-svg-core/src/Converter.js:283:18)
    at async Converter.convert (/var/task/node_modules/convert-svg-core/src/Converter.js:185:12)
    at async API.convert (/var/task/node_modules/convert-svg-core/src/API.js:80:16)
    at async handler (/var/task/.next/server/pages/api/misc/aspng.js:50:23)
    at async Object.apiResolver (/var/task/node_modules/next/dist/server/api-utils/node.js:185:9)
    at async NextNodeServer.runApi (/var/task/node_modules/next/dist/server/next-server.js:395:9)
    at async Object.fn (/var/task/node_modules/next/dist/server/base-server.js:496:37)
    at async Router.execute (/var/task/node_modules/next/dist/server/router.js:226:36)

It seems like the puppeteer version used by this package works only with Node 14, not Node 16.

Some insight... https://github.com/vercel/community/discussions/124

nevenhsu commented 1 year ago

Do you have any solution to this issue? I change node to 14 in the vercel setting, but it doesn't work.