Use npm as fallback if pnpm isn't available & more robust pnpm installation
This commit is contained in:
@@ -65,12 +65,16 @@ async function executeAppLocalNode({
|
||||
appId: number;
|
||||
event: Electron.IpcMainInvokeEvent;
|
||||
}): Promise<void> {
|
||||
const process = spawn("pnpm install && pnpm run dev --port 32100", [], {
|
||||
cwd: appPath,
|
||||
shell: true,
|
||||
stdio: "pipe", // Ensure stdio is piped so we can capture output/errors and detect close
|
||||
detached: false, // Ensure child process is attached to the main process lifecycle unless explicitly backgrounded
|
||||
});
|
||||
const process = spawn(
|
||||
"(pnpm install && pnpm run dev --port 32100) || (npm install && npm run dev -- --port 32100)",
|
||||
[],
|
||||
{
|
||||
cwd: appPath,
|
||||
shell: true,
|
||||
stdio: "pipe", // Ensure stdio is piped so we can capture output/errors and detect close
|
||||
detached: false, // Ensure child process is attached to the main process lifecycle unless explicitly backgrounded
|
||||
}
|
||||
);
|
||||
|
||||
// Check if process spawned correctly
|
||||
if (!process.pid) {
|
||||
|
||||
@@ -50,7 +50,7 @@ export function registerNodeHandlers() {
|
||||
// If not, try to install it using corepack.
|
||||
// If both fail, then pnpm is not available.
|
||||
checkCommandExists(
|
||||
"pnpm --version || corepack enable pnpm && pnpm --version"
|
||||
"pnpm --version || (corepack enable pnpm && pnpm --version) || (npm install -g pnpm@latest-10 && pnpm --version)"
|
||||
),
|
||||
]);
|
||||
// Default to mac download url.
|
||||
|
||||
Reference in New Issue
Block a user