neocotic / convert-svg

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

Can you provide a --puppeteer <json> example? #47

Closed rocuevas9511 closed 6 years ago

rocuevas9511 commented 6 years ago

Hi, I am trying to use this library in a microsoft/azure-functions-dotnet-core2.0 container image, so far I've succesfully installed it. First I tried to do a converison but ran into trouble cause chromium can not run headless as root. convert-svg-to-png failed: Error: Failed to launch chrome! [0730/161337.663797:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.

so I created another user and ran it

convert-svg-to-png failed: Error: Failed to launch chrome! [0730/161438.511709:FATAL:zygote_host_impl_linux.cc(116)] No usable sandbox! Update your kernel or see https://chromium.googlesource.com/chromium/src/+/master/docs/linux_suid_sandbox_development.md for more information on developing with the SUID sandbox. If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox.

so I'm trying to run using the --puppeteer option, like so convert-svg-to-png --puppeteer '{ "args": "[--no-sandbox]" }' svg1.svg but running into this convert-svg-to-png failed: TypeError: options.args.some is not a function

so I'm wondering what is the correct way to use it. Thanks!

rocuevas9511 commented 6 years ago

My bad... was sending a string with an array instead of an array with a string convert-svg-to-png --puppeteer '{ "args": ["--no-sandbox"] }' svg1.svg