npm install --global @opencode/cli@latest
If you have --ignore-scripts enabled, you’ll get the error when opening OpenCode:
opencode
Error: @opencode/cli's postinstall script was not run.
This occurs when installation scripts are disabled.
Run the package postinstall script or reinstall with scripts enabled.
Run the postinstall script:
node "$(npm root -g)/@opencode/cli/postinstall.mjs"
Then open OpenCode:
opencode