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;
|
appId: number;
|
||||||
event: Electron.IpcMainInvokeEvent;
|
event: Electron.IpcMainInvokeEvent;
|
||||||
}): Promise<void> {
|
}): Promise<void> {
|
||||||
const process = spawn("pnpm install && pnpm run dev --port 32100", [], {
|
const process = spawn(
|
||||||
|
"(pnpm install && pnpm run dev --port 32100) || (npm install && npm run dev -- --port 32100)",
|
||||||
|
[],
|
||||||
|
{
|
||||||
cwd: appPath,
|
cwd: appPath,
|
||||||
shell: true,
|
shell: true,
|
||||||
stdio: "pipe", // Ensure stdio is piped so we can capture output/errors and detect close
|
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
|
detached: false, // Ensure child process is attached to the main process lifecycle unless explicitly backgrounded
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
// Check if process spawned correctly
|
// Check if process spawned correctly
|
||||||
if (!process.pid) {
|
if (!process.pid) {
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ export function registerNodeHandlers() {
|
|||||||
// If not, try to install it using corepack.
|
// If not, try to install it using corepack.
|
||||||
// If both fail, then pnpm is not available.
|
// If both fail, then pnpm is not available.
|
||||||
checkCommandExists(
|
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.
|
// Default to mac download url.
|
||||||
|
|||||||
Reference in New Issue
Block a user