Skip to content

Native OpenCode test cannot find an installed binary

Source: Troubleshooting reference

Symptom: A fresh Linux bootstrap installs OpenCode successfully, but tests/opencode-native-argv.bats fails with FileNotFoundError: 'opencode'.

Root cause: The test entrypoint resolved its Node path before bootstrap installed nvm. Bootstrap runs in a child shell, so its updated PATH cannot reach the parent Bats runner. Tests that source installer helpers again can pass while tests using the inherited environment fail.

Confirm: Read the native argv test’s captured exception and check whether the runner’s PATH contains the installed nvm default’s bin directory.

Fix: tests/entrypoint.sh resolves the nvm default after bootstrap and adds it to the shared test environment. Keep this setup in the entrypoint so native commands work without per-test environment repairs.