Skip to content

fix: postinstall.mjs fails for scoped npm packages (e.g. @vibetechnologies/opencode) #234

Description

@dzianisv

Problem

The postinstall.mjs script in packages/opencode/script/postinstall.mjs hardcodes the platform-specific binary package name as opencode-${platform}-${arch} (unscoped). When the package is published under an npm scope (e.g. @vibetechnologies/opencode), the postinstall fails with:

Failed to setup opencode binary: Could not find package opencode-linux-x64: Cannot find module 'opencode-linux-x64/package.json'

The platform-specific packages published from a scoped fork get scoped names too (@vibetechnologies/opencode-linux-x64), but the postinstall never prepends the scope.

Root Cause

packages/opencode/script/postinstall.mjs:52 — constructs opencode-${platform}-${arch} without considering the npm scope.

Fix

Read the package's own package.json, extract the scope (text before the last /), and prepend it when constructing the platform package name. This works for both unscoped packages (opencode-linux-x64) and scoped ones (@vibetechnologies/opencode-linux-x64).

Labels

bug, build

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

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions