简体   繁体   English

azure devops 管道脚本给出了 bash 错误

[英]azure devops pipeline script is giving bash error

Azure devops pipeline script is giving error Bash exited with code '127'. Azure devops 管道脚本给出错误 Bash exited with code '127'。

YAML script is not working for devops pipeline. YAML 脚本不适用于 devops 管道。

    trigger:
      - master

   pool:
      vmImage: 'Ubuntu-16.04'

   steps:
      - task: NodeTool@0
   inputs:
       versionSpec: '10.x'
       displayName: 'Install Node.js'

   - script: |
        start
        displayName: 'npm install and build'

package.json there is script "start". package.json 有脚本“开始”。 After running this script it is showing error Bash exited with code '127'.运行此脚本后,它显示错误 Bash exited with code '127'。

Your YAML is invalid for multiple reasons.由于多种原因,您的 YAML 无效。 I first of all recommend that you not indent the root level (semantically it makes no difference).我首先建议您不要缩进根级别(从语义上讲没有区别)。 If you do that you'll more easily see that the first key ( trigger ) is indented more than the second key ( pool ):如果这样做,您将更容易看到第一个键 ( trigger ) 比第二个键 ( pool ) 缩进更多:

 trigger:
   - master

pool:
   vmImage: 'Ubuntu-16.04'

steps:
   - task: NodeTool@0

Then at the end of the file you have sequence entry indicator ( - at the same level as a value for the key inputs but that key already has a mapping as value (the one with keys versionSpec and displayName ), and you cannot have a node in YAML that has both sequence and mapping elements. It is not obvious though how to fix this.然后在文件的末尾,您有序列条目指示符( -与键inputs的值处于同一级别,但该键已经具有作为值的映射(具有键versionSpecdisplayName的映射),并且您不能有节点在同时具有序列和映射元素的 YAML 中。虽然如何解决这个问题并不明显。

Not fatal, but a recommendation anyway: you should indent the sequences with the same a mount of whitespace.不是致命的,但无论如何建议:您应该使用相同数量的空格缩进序列。 The sequence that is the value for trigger is indented 4 positions for the entry with an offset for the sequence-entry indicator of 2. For value of steps this is 5 resp.作为trigger值的序列在条目中缩进 4 个位置,序列条目指示符的偏移量为 2。对于steps值,这是 5 次。 3. It pays of to keep this consistent, and if you have a hard time doing that, there are tools available (both installable and online) that do that for you. 3. 保持一致是值得的,如果你很难做到这一点,有可用的工具(可安装的和在线的)可以为你做到这一点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure DevOps 管道中的命令行脚本出错 - Error with Command Line Script in Azure DevOps Pipeline Azure devops 管道中的命令行脚本错误 - Command line script error in Azure devops pipeline 如何使 Azure devops 管道任务失败,专门针对 bash 脚本中的失败 - How to fail Azure devops pipeline task specifically for failures in bash script Azure DevOps 管道无法识别 Bash 脚本中的管道变量(不使用 YAML 文件) - Azure DevOps pipeline not recognizing pipeline variable in Bash script (not using a YAML file) 无法在 Azure DevOps 管道“解析错误”中运行 PowerShell 脚本 - Can't run PowerShell script in Azure DevOps Pipeline 'parse error' Azure DevOps 检查以下 bash 脚本(yml 管道)内的 KeyVault 中是否存在密码 - Azure DevOps check if password exist in KeyVault inside of the following bash script (yml pipeline) Azure DevOps 管道条件脚本 arguments - Azure DevOps Pipeline conditional script arguments 在 Azure DevOps 管道中运行 ansible 脚本 - Running ansible script in Azure DevOps pipeline Azure Devops Pipeline 中的 Python 脚本执行 - Python script execution in Azure Devops Pipeline 为什么 azure devops 中的 Bash 脚本不起作用? - Why Bash script in azure devops not working?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM