Skip to content

postinstall.cjs fails silently — @opentui/core-darwin-arm64 not copied #140

Description

Bug

postinstall.cjs in @sylphai/adal-cli-darwin-arm64 creates node_modules/@opentui/ directory but fs.cpSync silently fails — directory is empty. TUI mode crashes with:

Error: ResolveMessage: Cannot find module "@opentui/core-darwin-arm64" from ".../adal-cli.js"

Root Cause

postinstall.cjs:

const src = path.join(__dirname, "opentui-native", "@opentui");
const dest = path.join(__dirname, "node_modules", "@opentui");
if (fs.existsSync(src)) {
  fs.mkdirSync(dest, { recursive: true });
  fs.readdirSync(src).forEach(pkg => {
    const srcPkg = path.join(src, pkg);
    const destPkg = path.join(dest, pkg);
    if (!fs.existsSync(destPkg)) {
      fs.cpSync(srcPkg, destPkg, { recursive: true });  // ← silently fails
    }
  });
}

The directory node_modules/@opentui/ exists but is empty after install. Running the same logic manually works fine.

Environment

  • AdaL CLI: 1.2.5
  • OS: macOS darwin-arm64 (M2)
  • Node: v24.1.0
  • Install: npm install -g @sylphai/adal-cli

Workaround

Manual copy fixes it:

cp -r /opt/homebrew/lib/node_modules/@sylphai/adal-cli/node_modules/@sylphai/adal-cli-darwin-arm64/opentui-native/@opentui/core-darwin-arm64 \
  /opt/homebrew/lib/node_modules/@sylphai/adal-cli/node_modules/@sylphai/adal-cli-darwin-arm64/node_modules/@opentui/

Suggested Fix

Add error handling to postinstall.cjsfs.cpSync should throw on failure, not silently succeed. Or use fs.copyFileSync with explicit error handling. The NX project had identical issue with @nx/nx-darwin-arm64.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions