electron-screenshot-service icon indicating copy to clipboard operation
electron-screenshot-service copied to clipboard

Doesn't throw an error and it just hangs on Ubuntu 16.04 with NodeJS 6.10.3

Open Defrothew opened this issue 7 years ago • 3 comments

First of all, thanks for this useful package.

I have server on DigitalOcean with this following setup: Ubuntu 16.04 NodeJS 6.10.3

Used the code below:

var fs = require('fs'); var screenshot = require('electron-screenshot-service');

screenshot({ url : 'http://google.de', width : 1024, height : 768 }) .then(function(img){ fs.writeFile('./out.png', img.data, function(err){ screenshot.close(); }); });

Unfortunately, when I run this code, it just hangs and doesn't display any errors in the console nor in the debug file for node.js.

Defrothew avatar May 23 '17 06:05 Defrothew

Same here with Debian Jessie (v8.8) and Node v8.1.2, the same code that works under Windows 10 / Node v8 hangs under Debian without throwing any error.

Thanks for help

PlanetIrata avatar Jun 20 '17 23:06 PlanetIrata

Same here, just got a new Digital Ocean machine with Ubuntu as pointed above and stalls.

taboca avatar Aug 17 '17 20:08 taboca

I had this problem trying to run this in a headless container, guess it's the same for you guys; electron needs a DISPLAY to render to, so you need to use something like Xvfb and probably some extra GUI dependencies if it's Ubuntu server edition.

Didn't take the time to figure out exactly what is needed, but in my Dockerfile I have these lines that makes it run for me:

RUN apt-get update && apt-get install -yq xvfb libgtk2.0-0 libgconf2-4 libnss3 libasound2 libxtst6 xvfb gtk2-engines-pixbuf libnotify-dev dbus-x11 libxss1
ENV DISPLAY :99
CMD xvfb-run --server-args='-screen 0 1024x768x24 -ac +extension RANDR' npm start

:99 is default DISPLAY for xvfb-run; there's multiple other ways to run this, and you may not use Docker at all, but in short:

  • install those dependecies
  • export DISPLAY as environment variable
  • start the app using Xvfb

Hope that helps.

kribblo avatar Oct 05 '17 14:10 kribblo