semantic-release "@semantic-release/exec" command failed in CI
The @semantic-release/exec plugin runs shell commands you define at each lifecycle step. When one of those commands exits non-zero, exec fails the release and reports which command and step failed. The fix is in your command, not semantic-release itself.
What this error means
The run fails with "Failed step \"prepare\" of plugin \"@semantic-release/exec\"" and the non-zero exit output of your configured command.
[semantic-release] > Failed step "prepare" of plugin "@semantic-release/exec"
Command failed with exit code 1: ./scripts/build.sh 1.4.0
./scripts/build.sh: line 3: tsc: command not foundCommon causes
The configured command itself fails
A build or version script referenced in prepareCmd/publishCmd exits non-zero because of a missing tool or a real error.
A tool used by the command is not on PATH
The command calls a binary (tsc, jq) not installed on the runner, so it fails before doing its work.
How to fix it
Reproduce and fix the command
- Run the exact prepareCmd/publishCmd locally with the version variable.
- Install any missing tools the command needs earlier in the job.
- Re-run once the command exits zero on its own.
["@semantic-release/exec", {
"prepareCmd": "npm run build -- --version ${nextRelease.version}"
}]Ensure command dependencies are installed
Install and expose the tools your exec commands call before the release step.
- run: npm ci
- run: npx semantic-releaseHow to prevent it
- Test exec commands locally with the nextRelease variables.
- Install every tool the command needs before semantic-release runs.
- Keep exec commands small and independently runnable.