Skip to content

Error command npx flowbite-react@latest initΒ #1620

@Ryftri

Description

@Ryftri
  • I have searched the Issues to see if this bug has already been reported
  • I have tested the latest version

Steps to reproduce

  1. Create a fresh Next.js project with Tailwind CSS (npx create-next-app@latest).
  2. Navigate into the new project directory (cd my-app).
  3. Run the official initialization command: npx flowbite-react@latest init.

Current behavior

The init CLI command fails during the dependency installation step. It outputs a critical error: Failed to install flowbite-react: Error: spawn npm ENOENT.

However, the script does not stop after this failure. It continues to create all the configuration files and then incorrectly reports a success message: βœ… Flowbite React has been successfully initialized!.

This is a problem because it results in a broken project state (the main dependency is missing) and the success message is very misleading, making it difficult to debug.

Here is the full log from my terminal:

npx flowbite-react@latest init
Installing flowbite-react using npm...
Failed to install flowbite-react: Error: spawn npm ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:285:19)
    at onErrorNT (node:internal/child_process:483:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:90:21) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn npm',
  path: 'npm',
  spawnargs: [ 'i', 'flowbite-react' ]
}
Creating .flowbite-react\.gitignore file...
Creating .flowbite-react\class-list.json file...
Creating .flowbite-react\config.json file...
Creating .flowbite-react\init.tsx file...
Creating .vscode\settings.json with flowbite-react configuration...
Creating .vscode\extensions.json with flowbite-react configuration...
Updating src\app\globals.css with flowbite-react configuration...
Updating next.config.ts with withFlowbiteReact plugin...

βœ… Flowbite React has been successfully initialized!

Expected behavior

The CLI script should detect the installation failure and immediately stop execution. It should print a clear error message explaining that the setup was unsuccessful and should not proceed to create config files or display a success message.

Context

I am trying to initialize flowbite-react in a brand new Next.js project using the official CLI tool as instructed in the documentation.

This is a CLI issue, not related to a specific browser. Here are my environment details:

OS: Windows 11

Node.js version: v22.18.0

npm version: v11.4.2

Framework: Next.js 15+ (App Router, TypeScript, Tailwind CSS v4)

Metadata

Metadata

Assignees

Labels

πŸ› bugSomething isn't workingconfirmedThis bug was confirmed

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions