From e36d6a0cbe5bce55c135bb3329ec7f9781e058f5 Mon Sep 17 00:00:00 2001 From: Dax Raad Date: Fri, 15 May 2026 23:12:00 -0400 Subject: [PATCH] core: clarify postinstall error message when binary is missing Users installing with pnpm or --ignore-scripts now see a clear explanation of why the native binary is missing and exact steps to fix it. The shell script wrapper provides more actionable guidance than the previous Node.js fallback that only suggested running the postinstall script without context about why it wasn't run automatically. --- packages/opencode/script/publish.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/opencode/script/publish.ts b/packages/opencode/script/publish.ts index e4c1732d38..ac1cafff56 100755 --- a/packages/opencode/script/publish.ts +++ b/packages/opencode/script/publish.ts @@ -37,9 +37,16 @@ await $`cp ./script/postinstall.mjs ./dist/${pkg.name}/postinstall.mjs` await Bun.file(`./dist/${pkg.name}/LICENSE`).write(await Bun.file("../../LICENSE").text()) await Bun.file(`./dist/${pkg.name}/bin/${pkg.name}.exe`).write( [ - "#!/usr/bin/env node", - "console.error('The opencode native binary was not installed. Run `node postinstall.mjs` from the opencode-ai package directory to finish setup.')", - "process.exit(1)", + `echo "Error: ${pkg.name}-ai's postinstall script was not run." >&2`, + 'echo "" >&2', + 'echo "This occurs when using --ignore-scripts during installation, or when using a" >&2', + 'echo "package manager like pnpm that does not run postinstall scripts by default." >&2', + 'echo "" >&2', + 'echo "To fix this, run the postinstall script manually:" >&2', + `echo " cd node_modules/${pkg.name}-ai && node postinstall.mjs" >&2`, + 'echo "" >&2', + `echo "Or reinstall ${pkg.name}-ai without the --ignore-scripts flag." >&2`, + "exit 1", "", ].join("\n"), )