CircleCI 中 YAML 配置文件解析错误
YAML Configuration File Parsing Error in CircleCI
我一直在我的 Github 存储库上试用 CircleCI,但它的配置文件存在一些问题。我查看了 Node.js 管道的模板并根据它设计了我自己的测试。它应该做的就是安装 Node.js、检查其版本并安装最新的 npm 包。提交文件后,CircleCI 告诉我构建失败。当我查看日志时,我注意到 YAML 配置文件本身没有被正确解析。我在 Google 上四处挖掘都找不到任何有用的信息,对我的代码结构进行一些基本调整似乎也无济于事。
这是我的配置文件:
version: 2.0
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/node:12.15.0
# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
- image: circleci/mongo:3.4.4
working_directory: ~/repo
steps:
- checkout
- run:
name: "Update files"
command: |
curl -sSL "https://nodejs.org/dist/v12.15.0/node-v12.15.0.tar.gz"
npm @latest -g
- run:
name: "Check current version of Node.js"
command: node -v
这是日志文件:
#!/bin/sh -eo pipefail
#!/bin/sh -eo pipefail
# Unable to parse YAML
# while parsing a block mapping
# in 'string', line 7, column 3:
# build:
# ^
# expected <block end>, but found '-'
# in 'string', line 21, column 3:
# - run:
# ^
#
# -------
# Warning: This configuration was auto-generated to show you the message above.
# Don't rerun this job. Rerunning will have no effect.
false
yaml
对 indentation/number 的空格非常严格。在您的情况下,问题在于步骤缩进
version: 2.0
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/node:12.15.0
# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
- image: circleci/mongo:3.4.4
working_directory: ~/repo
steps:
- checkout
- run:
name: "Update files"
command: |
curl -sSL "https://nodejs.org/dist/v12.15.0/node-v12.15.0.tar.gz"
npm @latest -g
- run:
name: "Check current version of Node.js"
command: node -v
我一直在我的 Github 存储库上试用 CircleCI,但它的配置文件存在一些问题。我查看了 Node.js 管道的模板并根据它设计了我自己的测试。它应该做的就是安装 Node.js、检查其版本并安装最新的 npm 包。提交文件后,CircleCI 告诉我构建失败。当我查看日志时,我注意到 YAML 配置文件本身没有被正确解析。我在 Google 上四处挖掘都找不到任何有用的信息,对我的代码结构进行一些基本调整似乎也无济于事。
这是我的配置文件:
version: 2.0
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/node:12.15.0
# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
- image: circleci/mongo:3.4.4
working_directory: ~/repo
steps:
- checkout
- run:
name: "Update files"
command: |
curl -sSL "https://nodejs.org/dist/v12.15.0/node-v12.15.0.tar.gz"
npm @latest -g
- run:
name: "Check current version of Node.js"
command: node -v
这是日志文件:
#!/bin/sh -eo pipefail
#!/bin/sh -eo pipefail
# Unable to parse YAML
# while parsing a block mapping
# in 'string', line 7, column 3:
# build:
# ^
# expected <block end>, but found '-'
# in 'string', line 21, column 3:
# - run:
# ^
#
# -------
# Warning: This configuration was auto-generated to show you the message above.
# Don't rerun this job. Rerunning will have no effect.
false
yaml
对 indentation/number 的空格非常严格。在您的情况下,问题在于步骤缩进
version: 2.0
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/node:12.15.0
# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
- image: circleci/mongo:3.4.4
working_directory: ~/repo
steps:
- checkout
- run:
name: "Update files"
command: |
curl -sSL "https://nodejs.org/dist/v12.15.0/node-v12.15.0.tar.gz"
npm @latest -g
- run:
name: "Check current version of Node.js"
command: node -v