Skip to content

fix: runScript missing cwd causes tsx resolution failure #5

Description

@Hugo-DL

Bug

npx openutter join <url> --anon --bot-name "Bot" fails with ERR_MODULE_NOT_FOUND: Cannot find package 'tsx' when run from a directory that does not have tsx in its node_modules.

Root Cause

In bin/openutter.mjs, the runScript() function spawns Node with --import tsx but does not set cwd: pkgRoot:

function runScript(scriptName, args) {
  const scriptPath = join(skillSourceDir, "scripts", scriptName);
  // ...
  const result = spawnSync(process.execPath, ["--import", "tsx", scriptPath, ...args], {
    stdio: "inherit",
    // ← missing cwd: pkgRoot
  });
}

Node resolves --import tsx relative to the current working directory. Since tsx is a dependency of the openutter package (in its own node_modules), it is only resolvable when cwd is the package root.

Other functions in the same file (runNodeCommand, runPlaywrightCommand) correctly set cwd: pkgRoot. This is an inconsistency.

Reproduction

cd /tmp  # or any directory without tsx
npx openutter join https://meet.google.com/abc-defg-hij --anon --bot-name "Bot"
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'tsx' imported from /tmp/

Fix

Add cwd: pkgRoot to the spawnSync call in runScript(), consistent with the other spawn helpers:

const result = spawnSync(process.execPath, ["--import", "tsx", scriptPath, ...args], {
  stdio: "inherit",
  cwd: pkgRoot,  // ← fix
});

Environment

  • Node.js v25.8.0
  • openutter 0.1.7
  • macOS (arm64)

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