bug: bare `task-master` crashes — TUI launcher imports undeclared `react` before the not-implemented check

Author: ChrisGVECreated Jul 28, 2026Updated Jul 28, 2026

Summary

Running task-master with no arguments crashes immediately on a fresh global install of [email protected]:

Error: Cannot find package 'react' imported from /usr/local/lib/node_modules/task-master-ai/dist/commands-CPFR5qh3.js

react is not declared in the package's dependencies (verified against both the installed package.json and npm view [email protected] dependencies), and it is not present anywhere in the install tree. There is no peerDependencies block either.

This is the same code path as #1589 (loadTUI is not defined, fixed by #1592), regressed with a new symptom.

Root cause

The no-argument path routes straight to the TUI launcher:

javascript
async function xt(e = process.argv) {
  if (e.length <= 2) { await Q(); return }   // no args -> TUI

The launcher imports react before checking whether a TUI implementation actually exists:

javascript
async function bt() { return null }          // TUI not shipped
async function Q() {
  let e = await import(`react`),             // throws here
      t = await bt();
  if (!t) {                                  // never reached
    console.log(`TUI mode coming soon!`);
    console.log(`Showing help instead...`);
    ...
  }

Since bt() unconditionally returns null, the react import is pure dead weight on every no-arg invocation — the code always takes the "TUI mode coming soon, showing help instead" branch, but only after paying for an import that cannot resolve.

Impact

task-master with no arguments is unusable on a clean install. This is the first thing a new user types after installing. Every subcommand works normally (task-master --help, list, next), so the breakage is confined to the bare invocation — but that is also the least discoverable place to hit an error.

task-master tui / task-master repl hit the same crash for the same reason.

Suggested fix

Move the import after the availability check, so the placeholder branch never touches react:

javascript
async function Q() {
  let t = await bt();
  if (!t) { /* coming soon + help */ return }
  let e = await import(`react`);
  ...
}

If the import is meant to stay eager once the TUI ships, react (and ink) should be declared as real dependencies.

Reproduction

bash
npm install -g [email protected]
task-master

Workaround

Use any subcommand (task-master --help), or npm install -g react to satisfy the resolution — with react present the branch completes and prints "TUI mode coming soon! / Showing help instead..." followed by the help output, exiting 0.

Environment

  • task-master-ai 0.43.1 (global, npm prefix /usr/local)
  • npm 12.0.1
  • macOS (darwin 25.5.0)

Source: eyaltoledano/claude-task-master