Skip to content

Commit c02a977

Browse files
fix: Error: spawn npm ENOENT (#1621)
* fix: Error: spawn npm ENOENT * add `withWindowsSupport` for all commands
1 parent d61afda commit c02a977

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

.changeset/gold-actors-doubt.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"flowbite-react": patch
3+
---
4+
5+
fix: Error: spawn npm ENOENT

bun.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
},
111111
"packages/ui": {
112112
"name": "flowbite-react",
113-
"version": "0.12.5",
113+
"version": "0.12.7",
114114
"bin": {
115115
"flowbite-react": "./dist/cli/bin.js",
116116
},

packages/ui/src/cli/commands/install.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,20 @@ export async function installPackage() {
2929
);
3030
const { command = "", args } = resolveCommand(pm.agent, "add", [`${packageName}@latest`]) ?? {};
3131
console.log(`Updating ${packageName} to latest version using ${pm.name}...`);
32-
await execCommand(command, args);
32+
await execCommand(withWindowsSupport(command), args);
3333
}
3434
return;
3535
}
3636

3737
const { command = "", args } = resolveCommand(pm.agent, "add", [packageName]) ?? {};
3838

3939
console.log(`Installing ${packageName} using ${pm.name}...`);
40-
await execCommand(command, args);
40+
await execCommand(withWindowsSupport(command), args);
4141
} catch (error) {
4242
console.error(`Failed to install ${packageName}:`, error);
4343
}
4444
}
45+
46+
function withWindowsSupport(command: string): string {
47+
return process.platform === "win32" ? `${command}.cmd` : command;
48+
}

0 commit comments

Comments
 (0)