Spaces:
Runtime error
Runtime error
File size: 832 Bytes
7d1ef26 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | // postinstall.js - Ensures native modules compile correctly on Linux/HF
const { execSync } = require("child_process");
const os = require("os");
console.log("[INSTALL] Checking environment...");
// If running on Linux (like HF Spaces), ensure build tools are conceptually ready
// Note: HF Spaces usually has build-tools installed, but this is a safe guard.
if (os.platform() === 'linux') {
console.log("[INSTALL] Linux environment detected. Ensuring native modules are ready...");
try {
// Rebuild better-sqlite3 if needed
execSync("npm rebuild better-sqlite3", { stdio: "inherit" });
console.log("[INSTALL] Native modules rebuilt successfully.");
} catch (e) {
console.warn("[INSTALL] Warning: Could not rebuild native modules. If the bot fails, ensure 'build-essential' is installed on the host.");
}
} |