Skip to content

Conversation

@SutuSebastian
Copy link
Collaborator

@SutuSebastian SutuSebastian commented Sep 1, 2025

Summary by CodeRabbit

  • Bug Fixes

    • Fixed an issue causing the install command to fail on Windows (spawn ENOENT), including the update-to-latest flow. Windows users can now run installs reliably without command-not-found errors.
  • Chores

    • Published a patch release entry documenting the Windows install fix for the flowbite-react package.

@SutuSebastian SutuSebastian self-assigned this Sep 1, 2025
@SutuSebastian SutuSebastian added the 🐛 bug Something isn't working label Sep 1, 2025
@SutuSebastian SutuSebastian linked an issue Sep 1, 2025 that may be closed by this pull request
2 tasks
@changeset-bot
Copy link

changeset-bot bot commented Sep 1, 2025

🦋 Changeset detected

Latest commit: b715cd9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
flowbite-react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 1, 2025

Walkthrough

Adds a changeset declaring a patch for flowbite-react and updates the CLI install command to handle Windows by appending .cmd before executing npm-related commands (including update-to-latest), preventing spawn ENOENT on win32 while leaving other logic unchanged.

Changes

Cohort / File(s) Summary
Release metadata
\.changeset/gold-actors-doubt.md
Adds a changeset documenting a patch release noting a fix for "Error: spawn npm ENOENT".
CLI install command (Windows support)
packages/ui/src/cli/commands/install.ts
Adds withWindowsSupport(command: string) and applies it to commands passed to execCommand (including the update-to-latest path), appending .cmd on Windows; no exported API changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant CLI as Install Command
  participant H as withWindowsSupport()
  participant X as execCommand()
  participant OS as OS/npm

  U->>CLI: run install
  CLI->>H: adapt command (win32? add ".cmd")
  H-->>CLI: adaptedCommand
  CLI->>X: execCommand(adaptedCommand, args)
  X->>OS: spawn process
  OS-->>X: exit code / error
  X-->>CLI: result
  CLI-->>U: output
  note over H,X: Changed: Windows-specific command adaptation before exec
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Possibly related PRs

Suggested labels

confirmed

Suggested reviewers

  • rluders

Poem

I thump my paws—installers cheer!
A .cmd hops in, Windows clear.
No ENOENT to spoil the run,
The CLI’s ready, tasks well done.
With gentle whiskers, I approve—🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 1620-error-command-npx-flowbite-reactlatest-init

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@vercel
Copy link

vercel bot commented Sep 1, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
flowbite-react Ready Ready Preview Comment Sep 1, 2025 10:47am
flowbite-react-storybook Ready Ready Preview Comment Sep 1, 2025 10:47am

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (3)
.changeset/gold-actors-doubt.md (1)

5-5: Make the changeset note explicit about the Windows scope and the actual fix.

Helps release notes consumers understand what changed and why.

-fix: Error: spawn npm ENOENT
+fix(cli, windows): append .cmd to package manager commands to avoid "spawn ENOENT"
packages/ui/src/cli/commands/install.ts (2)

37-40: Guard against empty command from resolveCommand for clearer failure.

If resolveCommand returns undefined, you may try to spawn an empty string (or “.cmd” on Windows). Fail fast with a helpful message.

   const { command = "", args } = resolveCommand(pm.agent, "add", [packageName]) ?? {};
 
   console.log(`Installing ${packageName} using ${pm.name}...`);
-  await execCommand(withWindowsSupport(command), args);
+  if (!command) {
+    throw new Error(`Unable to resolve '${pm.name}' add command for ${packageName}`);
+  }
+  await execCommand(withWindowsSupport(command), args);

Apply the same check in the update branch above.


3-3: Consider centralizing Windows command resolution inside execCommand.

Moving the shim into ../utils/exec-command keeps all spawn behavior consistent and avoids future call-site drift.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between d61afda and fe1a2ac.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • .changeset/gold-actors-doubt.md (1 hunks)
  • packages/ui/src/cli/commands/install.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
packages/ui/src/cli/commands/install.ts (1)
packages/ui/src/cli/utils/exec-command.ts (1)
  • execCommand (12-47)
🪛 LanguageTool
.changeset/gold-actors-doubt.md

[grammar] ~5-~5: There might be a mistake here.
Context: ... patch --- fix: Error: spawn npm ENOENT

(QB_NEW_EN)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: 🧰 Build

@SutuSebastian SutuSebastian merged commit c02a977 into main Sep 1, 2025
7 of 8 checks passed
@SutuSebastian SutuSebastian deleted the 1620-error-command-npx-flowbite-reactlatest-init branch September 1, 2025 10:47
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/ui/src/cli/commands/install.ts (1)

46-48: Avoid potential “.cmd.cmd” duplication; keep the simple approach.

Maintain the preferred simple strategy but guard against already-suffixed commands.

-function withWindowsSupport(command: string): string {
-  return process.platform === "win32" ? `${command}.cmd` : command;
-}
+function withWindowsSupport(command: string): string {
+  if (process.platform !== "win32") return command;
+  // Prevent duplicate suffix when resolveCommand already returns *.cmd
+  return command.toLowerCase().endsWith(".cmd") ? command : `${command}.cmd`;
+}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between fe1a2ac and b715cd9.

📒 Files selected for processing (1)
  • packages/ui/src/cli/commands/install.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: SutuSebastian
PR: themesberg/flowbite-react#1621
File: packages/ui/src/cli/commands/install.ts:46-48
Timestamp: 2025-09-01T10:44:59.759Z
Learning: In the flowbite-react CLI install command, the maintainer prefers a simple Windows support implementation that appends .cmd to all commands on win32, rather than a more defensive approach, because they know the command will only be package managers from the resolveCommand function.
📚 Learning: 2025-09-01T10:44:59.759Z
Learnt from: SutuSebastian
PR: themesberg/flowbite-react#1621
File: packages/ui/src/cli/commands/install.ts:46-48
Timestamp: 2025-09-01T10:44:59.759Z
Learning: In the flowbite-react CLI install command, the maintainer prefers a simple Windows support implementation that appends .cmd to all commands on win32, rather than a more defensive approach, because they know the command will only be package managers from the resolveCommand function.

Applied to files:

  • packages/ui/src/cli/commands/install.ts
🧬 Code graph analysis (1)
packages/ui/src/cli/commands/install.ts (1)
packages/ui/src/cli/utils/exec-command.ts (1)
  • execCommand (12-47)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: 🧰 Build
🔇 Additional comments (2)
packages/ui/src/cli/commands/install.ts (2)

32-32: Good fix: Windows wrapper applied to the update-to-latest path.

This addresses the ENOENT on win32 for the “update to latest” flow. LGTM.


40-40: Consistent application on the regular install path.

Same Windows-safe invocation here—nice consistency. LGTM.

@github-actions github-actions bot mentioned this pull request Sep 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Error command npx flowbite-react@latest init

2 participants