Fix opencode not found: symlink installer binary to /usr/local/bin
The opencode curl installer puts the binary in /root/.local/bin which isn't on PATH for the nextjs user. Add a symlink to /usr/local/bin after install. Also ensure /usr/local/bin is always in the PATH passed to spawned agent processes.
This commit is contained in:
@@ -14,6 +14,12 @@ export async function buildAgentEnv(
|
||||
): Promise<NodeJS.ProcessEnv> {
|
||||
const env: NodeJS.ProcessEnv = { ...process.env, TERM: "xterm-256color" };
|
||||
|
||||
// Ensure global bin paths are available (npm -g, opencode installer)
|
||||
const path = env.PATH || "/usr/local/bin:/usr/bin:/bin";
|
||||
if (!path.includes("/usr/local/bin")) {
|
||||
env.PATH = `/usr/local/bin:${path}`;
|
||||
}
|
||||
|
||||
const providersToInject =
|
||||
config.runtime === "opencode"
|
||||
? Object.keys(PROVIDER_ENV_VARS)
|
||||
|
||||
Reference in New Issue
Block a user