Install a dependency using Electron on Linux

Viewed 121

I'm developing an Electron application, from which I need to install a dependency.
The package sudo-prompt ended up partly working.
My code:

const sudo = require("sudo-prompt");
sudo.exec("apt-get install lib32gcc1", {name: "SteamCMD GUI"}, (error, stdout, stderr) => {
   // The code here doesn't execute, as it possibly waits for the user's confirmation to press Y and Enter 
});

And the dependency never gets installed.

How to solve it?
Thanks!

1 Answers

Try it like this:

const sudo = require("sudo-prompt");// The -y did the trick
sudo.exec("apt-get install lib32gcc1 -y", {name: "SteamCMD GUI"}, (error, stdout, stderr) => {
   // The code here doesn't execute, as it possibly waits for the user's confirmation to press Y and Enter 
});

The -y option makes apt-get skip the prompts.

Related