私は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
、プロンプトをスキップします。
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加