Weird behavior when starting electron with "startx"


I’m trying to start electron from a terminal using startx. I’m writing a kiosk-type app and am trying to keep it as lean as possible. I have run into two problems (VM is Ubuntu 16.04, running on Windows 10 host). For contrast, I will refer to running electron in 2 different modes: from the desktop (meaning I logged into a window manager such as LXDE or Plasma and opened a terminal window) or using startx (meaning I am not logging into a desktop window manager, but am only logged in to a terminal and am attempting to run electron from there).

  1. From the terminal, running “startx electron .” exits immediately. Here’s where things get weird. There is no error. Running “which electron” does indeed show the correct path to the electron executable. If I run “startx /long/path/to/electron/executable .”, though, it works correctly. Lastly, if I actually log into a window manager, the command “electron .” works just fine.

  2. When running electron normally in the desktop, I can access the webcam using webrtc (mediastream). When running electron through startx, the webcam is not available (although audio streams are present for the mic, only the camera is not available). I cannot find this as a documented limitation anywhere, so any direction would be appreciated.