Skip to content

Commit e36d6a0

Browse files
committed
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.
1 parent cc9c0b1 commit e36d6a0

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

packages/opencode/script/publish.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,16 @@ await $`cp ./script/postinstall.mjs ./dist/${pkg.name}/postinstall.mjs`
3737
await Bun.file(`./dist/${pkg.name}/LICENSE`).write(await Bun.file("../../LICENSE").text())
3838
await Bun.file(`./dist/${pkg.name}/bin/${pkg.name}.exe`).write(
3939
[
40-
"#!/usr/bin/env node",
41-
"console.error('The opencode native binary was not installed. Run `node postinstall.mjs` from the opencode-ai package directory to finish setup.')",
42-
"process.exit(1)",
40+
`echo "Error: ${pkg.name}-ai's postinstall script was not run." >&2`,
41+
'echo "" >&2',
42+
'echo "This occurs when using --ignore-scripts during installation, or when using a" >&2',
43+
'echo "package manager like pnpm that does not run postinstall scripts by default." >&2',
44+
'echo "" >&2',
45+
'echo "To fix this, run the postinstall script manually:" >&2',
46+
`echo " cd node_modules/${pkg.name}-ai && node postinstall.mjs" >&2`,
47+
'echo "" >&2',
48+
`echo "Or reinstall ${pkg.name}-ai without the --ignore-scripts flag." >&2`,
49+
"exit 1",
4350
"",
4451
].join("\n"),
4552
)

0 commit comments

Comments
 (0)