From 68e81c47c3600c76f9f24991594406747e8c2602 Mon Sep 17 00:00:00 2001 From: mrloop Date: Sun, 17 Aug 2025 08:56:54 +0100 Subject: [PATCH] fix: installation via volta broken due to symbolic links pointing to tmp file The PR uses a relative path for symbolic link See https://github.com/sst/opencode/issues/197 Fix verified locally by running local npm registry: ``` npx verdaccio@latest --listen 4873 ``` And publishing opencode to that: ``` OPENCODE_VERSION="1.0.0-local" OPENCODE_DRY="false" bun run script/publish.ts ``` The `script/publish.ts` was updated to publish to local registry by appending `--registry http://localhost:4873` to the `bun install` commands. Volta was then used to install from the local registry: ``` NPM_CONFIG_REGISTRY=http://localhost:4873 npm_config_registry=http://localhost:4873 volta install opencode-ai@1.0.0-local ``` --- packages/opencode/script/postinstall.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/opencode/script/postinstall.mjs b/packages/opencode/script/postinstall.mjs index 2c69741231..e03cf22cef 100644 --- a/packages/opencode/script/postinstall.mjs +++ b/packages/opencode/script/postinstall.mjs @@ -79,7 +79,7 @@ function main() { } // Create symlink to the actual binary - fs.symlinkSync(binaryPath, binScript) + fs.symlinkSync(path.relative(path.dirname(binScript), binaryPath), binScript) console.log(`opencode binary symlinked: ${binScript} -> ${binaryPath}`) } catch (error) { console.error("Failed to create opencode binary symlink:", error.message)