[英]Install a dependency using Electron on Linux
我正在開發一個Electron應用程序,需要從中安裝依賴項。
軟件包sudo-prompt最終部分起作用。
我的代碼:
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
});
並且依賴關系永遠不會被安裝。
怎么解決呢?
謝謝!
像這樣嘗試:
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
});
-y
選項使apt-get
跳過提示。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.