# Got Error on YAML

**URL:** <https://discuss.circleci.com/t/got-error-on-yaml/37474>\
**Category:** Build Environment\
**Created:** [September 21, 2020, 8:37am UTC](https://discuss.circleci.com/t/got-error-on-yaml/37474 "2020-09-21T08:37:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![krissnawat](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/krissnawat/32/25649_2.png) [@krissnawat](https://discuss.circleci.com/u/krissnawat)\
**Post date:** [September 21, 2020, 8:37am UTC](https://discuss.circleci.com/t/got-error-on-yaml/37474/1 "2020-09-21T08:37:12Z")

</div>

Hi I got an error

![image](https://global.discourse-cdn.com/circleci/original/3X/9/1/91a5bb4bf4e50d5f417da96356239a898f6953d5.png)

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

---

<div class="post-metadata">

**Author:** ![punkdata](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/punkdata/32/25224_2.png) [@punkdata](https://discuss.circleci.com/u/punkdata)\
**Post date:** [September 21, 2020, 2:25pm UTC](https://discuss.circleci.com/t/got-error-on-yaml/37474/2 "2020-09-21T14:25:33Z")

</div>

> [@krissnawat](#):
>
> ```auto
> 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
> 
> ```

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](https://circleci.com/docs/2.0/local-cli/)

```auto
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

```

---

<div class="post-metadata">

**Author:** ![krissnawat](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/krissnawat/32/25649_2.png) [@krissnawat](https://discuss.circleci.com/u/krissnawat)\
**Post date:** [September 21, 2020, 4:36pm UTC](https://discuss.circleci.com/t/got-error-on-yaml/37474/3 "2020-09-21T16:36:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![punkdata](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/punkdata/32/25224_2.png) [@punkdata](https://discuss.circleci.com/u/punkdata)\
**Post date:** [September 22, 2020, 1:58am UTC](https://discuss.circleci.com/t/got-error-on-yaml/37474/4 "2020-09-22T01:58:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [October 2, 2020, 1:58am UTC](https://discuss.circleci.com/t/got-error-on-yaml/37474/5 "2020-10-02T01:58:12Z")

</div>

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