Skip to content

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

Description

@ChrisGVE

Summary

Running task-master with no arguments crashes immediately on a fresh global install of task-master-ai@0.43.1:

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 task-master-ai@0.43.1 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:

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:

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:

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

npm install -g task-master-ai@0.43.1
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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions