fix: resolve ao start failure on npm global installs#620
Open
fireddd wants to merge 1 commit intoComposioHQ:mainfrom
Open
fix: resolve ao start failure on npm global installs#620fireddd wants to merge 1 commit intoComposioHQ:mainfrom
ao start failure on npm global installs#620fireddd wants to merge 1 commit intoComposioHQ:mainfrom
Conversation
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>
|
Review completed by Genesis Coder. Looks solid, no serious bugs found. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ao startalways 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 hoistingexistsSynccheck with afindPackageUphelper that walks upnode_modulesdirectories, mirroring Node's module resolution algorithmCloses #619
Root Cause
checkBuilt()inpackages/cli/src/lib/preflight.tschecked exactly one path:This works with pnpm (which symlinks deps into each package's
node_modules), but npm global installs hoistao-coreto a parentnode_modules. The check always fails even when everything is properly installed and built.Approach
A
findPackageUphelper walks up fromwebDir, checkingnode_modules/@composio/ao-coreat each level until it finds it or hits the filesystem root. This mirrors Node's own resolution algorithm using simpleexistsSynccalls.createRequire().resolve()was considered but ruled out because@composio/ao-core'sexportsfield doesn't expose./package.jsonas a subpath and only definesimportconditions (notrequire).Test plan
pnpm --filter=@composio/ao-cli buildsucceedsao start <project>works on npm global installao start <project>works in monorepo dev🤖 Generated with Claude Code