Launch NodeJS script with puppeteer on system startup Missing X server or $DISPLAY

77 Views Asked by At

I'm trying to launch a NodeJS script using puppeteer with headless = false, this script is run by PM2 (process manager) at startup. I'm not having a desktop environment, this is run on a remote server that is wired with HDMI and is supposed to display chrome page that my puppeteer drive.

I'm getting Missing X server or $DISPLAY

Do you know how can I proceed to make it work ? I want the X server to take the whole available screen size. I'm on debian.

My current command is pm2 start npm --name "Worker" --exp-backoff-restart-delay=100 -- start that start my package.json start script.

Thanks

1

There are 1 best solutions below

0
ScreamZ On

I was able to make it work by installing a desktop GUI like LXDE, and defining the environment variable DISPLAY=:0 in my program (which references the LXDE screen)