[英]Install a dependency using Electron on Linux
I'm developing an Electron application, from which I need to install a dependency. 我正在开发一个Electron应用程序,需要从中安装依赖项。
The package sudo-prompt ended up partly working. 软件包sudo-prompt最终部分起作用。
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! 谢谢!
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. -y
选项使apt-get
跳过提示。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.