fix: global install fails with ERR_MODULE_NOT_FOUND for workspace packages#336
Merged
khaliqgant merged 1 commit intomainfrom Jan 28, 2026
Merged
Conversation
…flow The verify-publish workflow was packing without building, causing global installs to fail with ERR_MODULE_NOT_FOUND for workspace packages. Changes: - Remove --ignore-scripts from npm ci to allow postinstall to run - Add explicit build step before npm pack in PR verification - Add setupWorkspacePackageLinks() to postinstall.js as fallback for global installs where bundledDependencies may not properly resolve workspace symlinks Fixes global install error: Cannot find package '@agent-relay/daemon' 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🔴 verify job doesn't use local tarball on PRs, testing npm package instead of PR changes
The verify job's Get package spec step (lines 61-73) doesn't check for pull_request event and always sets SPEC="agent-relay" (the npm package), ignoring the local tarball that was just built.
Click to expand
Problem
In the verify job, the workflow:
- Builds and packs the local code with
npm pack(line 54) - But then the
Get package specstep only checksinputs.versionand defaults toSPEC="agent-relay"from npm
Compare with the verify-macos job at .github/workflows/verify-publish.yml:346-361 which correctly handles PRs:
if [ "${{ github.event_name }}" = "pull_request" ]; then
SPEC="$(pwd)/$(ls agent-relay-*.tgz | head -1)"
else
...
fiImpact
On PRs, the verify job tests the published npm package instead of the PR's changes. This means:
- The PR's fix for global install (
setupWorkspacePackageLinks) is never tested - The workflow passes even if the PR introduces bugs
- False confidence that PR changes work correctly
Expected vs Actual
- Expected: On PRs, test the local tarball built from PR code
- Actual: On PRs, test the existing npm package
agent-relay@latest
(Refers to lines 61-73)
Recommendation: Add a check for pull_request event similar to the verify-macos job:
if [ "${{ github.event_name }}" = "pull_request" ]; then
SPEC="$(pwd)/$(ls agent-relay-*.tgz | head -1)"
elif [ -z "$VERSION_INPUT" ] || [ "$VERSION_INPUT" = "latest" ]; then
...Was this helpful? React with 👍 or 👎 to provide feedback.
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
Problem
When globally installing agent-relay, the CLI fails with:
This happens because:
npm ci --ignore-scriptsthennpm packwithout buildingpackages/*/dist/folders don't existSolution
--ignore-scriptsfromnpm ciin verify-publish workflownpm run buildstep beforenpm packon PRssetupWorkspacePackageLinks()in postinstall.js as a fallback to create symlinks fromnode_modules/@agent-relay/*topackages/*for bundled/global installsTest plan
npm install -g agent-relaythenagent-relay --versionnpx agent-relay --version🤖 Generated with Claude Code