无法找到可执行文件:';bash';Azure Devops管道上的简单脚本出错
如果运行azure devops管道,则会出现以下错误:无法找到可执行文件:';bash';Azure Devops管道上的简单脚本出错,bash,azure-devops,yaml,azure-pipelines,Bash,Azure Devops,Yaml,Azure Pipelines,如果运行azure devops管道,则会出现以下错误: ##[error]Unable to locate executable file: 'bash'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the
##[error]Unable to locate executable file: 'bash'. Please verify either the file path exists or the
file can be found within a directory specified by the PATH environment variable. Also check the file
mode to verify the file is executable.
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
steps:
- script:
echo Starting the build
./gradlew build
displayName: 'Build
我用我的自托管代理和microsoft托管代理进行了尝试,两者都有相同的错误
这是我的管道:
##[error]Unable to locate executable file: 'bash'. Please verify either the file path exists or the
file can be found within a directory specified by the PATH environment variable. Also check the file
mode to verify the file is executable.
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
steps:
- script:
echo Starting the build
./gradlew build
displayName: 'Build
您需要为脚本设置工作目录,如此处所述:
-脚本:#脚本路径或内联
工作目录:#
显示名称:#
例如,如果您有一个具有如下结构的存储库:
RepoName
- Folder1
- scriptToRun
- Folder2
workingDirectory的值应为:
-脚本:./scriptToRun
工作目录:“$(Build.SourcesDirectory)/Folder1”
displayName:“生成”
或者您也可以跳过workingDirectory并给出脚本的完整路径。
另请注意,此示例适用于单个存储库签出。如果您签出多个回购,路径将不同。我也有同样的问题,最初我给了我的自托管代理一个PAT,可以访问代理池读取/管理权限,因为这是它在文档中声明的,然后我开始出现此错误,尽管bash显然在我的path环境变量中 然后,我移除了代理,将其添加回,这一次给了它一个完全访问权限的轻拍
我不再收到bash错误。对于内联脚本,我面临同样的错误。我如何解决它?