[英]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
的值处于同一级别,但该键已经具有作为值的映射(具有键versionSpec
和displayName
的映射),并且您不能有节点在同时具有序列和映射元素的 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.