Got Error on YAML

Hi I got an error

image

here the config file

 version: 2
   jobs:
    build:
     docker:
     # specify the version you desire here
        - image: circleci/node:7.10
       working_directory: ~/repo
      steps:
     # Checkout the code from the branch into the working_directory
        - checkout
      # Log the current branch
        - run:
           name: Show current branch
            command: echo ${CIRCLE_BRANCH}
       # Download and cache dependencies
     - restore_cache:
       keys:
     - v1-dependencies-{{ checksum "package.json" }}
      # fallback to using the latest cache if no exact match is found
      - v1-dependencies-
      - run: yarn install
      - save_cache:
      paths:
        - node_modules
      key: v1-dependencies-{{ checksum "package.json" }}
    
     # run tests!
        - run: yarn test
       - run: sudo apt-get update && sudo apt-get install -y python-dev
       - run: sudo curl -O https://bootstrap.pypa.io/get-pip.py
       - run: sudo python get-pip.py
      - run: sudo pip install awscli --upgrade
      - run: aws --version
      - run: aws s3 ls
      - run: yarn run deploy

thank for advice

your YAML was malformed. Indentation matters in YAML so you have to be mindful of how things are laid out in your syntax. I think this should clean things up for you. You can also use the CircleCI CLI to validate config.yml for CircleCI check out the docs for the CLI tool

version: 2
jobs:
    build:
        docker:
        # specify the version you desire here
        - image: circleci/node:7.10
        working_directory: ~/repo
        steps:
        # Checkout the code from the branch into the working_directory
        - checkout
        # Log the current branch
        - run:
            name: Show current branch
            command: echo ${CIRCLE_BRANCH}
        # Download and cache dependencies
        - restore_cache:
            keys:
              - v1-dependencies-{{ checksum "package.json" }}
              # fallback to using the latest cache if no exact match is found
              - v1-dependencies-
        - run: yarn install
        - save_cache:
            paths:
              - node_modules
            key: v1-dependencies-{{ checksum "package.json" }}
        # run tests!
        - run: yarn test
        - run: sudo apt-get update && sudo apt-get install -y python-dev
        - run: sudo curl -O https://bootstrap.pypa.io/get-pip.py
        - run: sudo python get-pip.py
        - run: sudo pip install awscli --upgrade
        - run: aws --version
        - run: aws s3 ls
        - run: yarn run deploy
2 Likes

would your suggest some easy tools that can help auto-correct :laughing:
I just confused and want some quick win because got stuck for two days.

You can use an IDE like MS Visual Code with the YAML extention or IntelliJ with the YAML plugin but validating the config.yml file with the CircleCI CLI is the best tool to validate the syntax.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.