Bitbucket Pipelines build failed with error in the build log: <command_name>: Command not found
Platform Notice: Cloud Only - This article only applies to Atlassian apps on the cloud platform.
Summary
Pipelines build failed with the following error in the build log: <command_name>: Command not found
Cause
A user-defined variable named PATH may have been configured in Workspace, Repository, or Deployment variables.
The tool you are trying to use may not be installed in the build environment.
Solution
Troubleshooting Steps:
Is a PATH variable defined as in Workspace, Repository, or Deployment variables?
YES
The shell uses $PATH to find commands. Defining a variable with the name PATH in Workspace, Repository, or Deployment variables overrides the default $PATH variable in the build environment, so commands may not be found, and you may encounter this error:
<command_name>: Command not found
To fix the issue, avoid using "PATH" as a variable name in the workspace, repository, and deployment variable sections. Try using a detailed name that adds more context on why the variable is being used, for example: "remote_path", "web_path", "destination_path" etc.
Note, BCLOUD-20162 - Command not found error on Pipelines tracks a feature request to alert users on the Pipeline variable page to avoid using "PATH" as a variable name.
NO
Is the tool that provides this command installed in the build environment? If not, you will need to install the tool in the build environment.
If your build runs on Atlassian's infrastructure or with a self-hosted Linux Docker runner, the build environment is the Docker image you use as a build container. You can either use a different Docker image as a build container that has this tool preinstalled, or you can install the tool during the Pipelines step by adding the necessary commands in the step's script in the bitbucket-pipelines.yml file.
If your build runs with a self-hosted Linux Shell, MacOS or Windows runner, these builds run directly on the host machine. The tool needs to be installed on the host machine where the runner is running.
If the tool that provides this command is installed and you are still getting this error, raise a Support Ticket and share the Pipeline build URL from bitbucket.org.
Was this helpful?