Skip to content

fix: resolve ao start failure on npm global installs#620

Open
fireddd wants to merge 1 commit intoComposioHQ:mainfrom
fireddd:fix/preflight-check-hoisted-deps
Open

fix: resolve ao start failure on npm global installs#620
fireddd wants to merge 1 commit intoComposioHQ:mainfrom
fireddd:fix/preflight-check-hoisted-deps

Conversation

@fireddd
Copy link
Copy Markdown
Collaborator

@fireddd fireddd commented Mar 22, 2026

Summary

  • ao start always fails with "Dependencies not installed" on npm global installs because the preflight check uses a hardcoded path that doesn't account for npm's dependency hoisting
  • Replace the single-directory existsSync check with a findPackageUp helper that walks up node_modules directories, mirroring Node's module resolution algorithm
  • Works correctly with pnpm workspaces, npm global installs, and yarn hoisting

Closes #619

Root Cause

checkBuilt() in packages/cli/src/lib/preflight.ts checked exactly one path:

resolve(webDir, "node_modules", "@composio", "ao-core")

This works with pnpm (which symlinks deps into each package's node_modules), but npm global installs hoist ao-core to a parent node_modules. The check always fails even when everything is properly installed and built.

Approach

A findPackageUp helper walks up from webDir, checking node_modules/@composio/ao-core at each level until it finds it or hits the filesystem root. This mirrors Node's own resolution algorithm using simple existsSync calls.

createRequire().resolve() was considered but ruled out because @composio/ao-core's exports field doesn't expose ./package.json as a subpath and only defines import conditions (not require).

Test plan

  • All 13 preflight tests pass
  • pnpm --filter=@composio/ao-cli build succeeds
  • ao start <project> works on npm global install
  • ao start <project> works in monorepo dev

🤖 Generated with Claude Code

The preflight `checkBuilt` check used a hardcoded path
(`<webDir>/node_modules/@composio/ao-core`) which only works with
pnpm's non-hoisted layout. npm global installs hoist dependencies
to a parent `node_modules`, causing the check to always fail with
"Dependencies not installed" even when everything is properly built.

Replace the single-directory check with a `findPackageUp` helper that
walks up `node_modules` directories — mirroring Node's own module
resolution. This works with pnpm workspaces, npm global installs,
and yarn hoisting.

Closes ComposioHQ#619

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jleechan2015
Copy link
Copy Markdown

Review completed by Genesis Coder. Looks solid, no serious bugs found.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: ao start fails with 'Dependencies not installed' on npm global installs

2 participants