# Restoring cache error

**URL:** <https://discuss.circleci.com/t/restoring-cache-error/38811>\
**Category:** Caching Dependencies\
**Tags:** circle-yml\
**Created:** [January 17, 2021, 1:19pm UTC](https://discuss.circleci.com/t/restoring-cache-error/38811 "2021-01-17T13:19:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bkawk](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/bkawk/32/26463_2.png) [@bkawk](https://discuss.circleci.com/u/bkawk)\
**Post date:** [January 17, 2021, 1:19pm UTC](https://discuss.circleci.com/t/restoring-cache-error/38811/1 "2021-01-17T13:19:00Z")

</div>

I’m completely new to circle CI, I managed to sign up for an account and linked my GitHub, I selected a repo, added the code that was provided, pushed the .circleci folder with config.yaml in it and I get an error  
` error computing cache key: template: cacheKey:1:30: executing "cacheKey" at <checksum "~/project/package-lock.json">: error calling checksum: open /home/circleci/project/package-lock.json: no such file or directory`  
My config file is the one circle suggested

```auto
version: 2.1
orbs:
  node: circleci/node@3.0.0
workflows:
  node-tests:
    jobs:
      - node/test

```

So I look in the docs and find this code snippet that looks like it may do the job

```auto
      - restore_cache:
          name: Restore Yarn Package Cache
          keys:
            - yarn-packages-{{ checksum "yarn.lock" }}
      - run:
          name: Install Dependencies
          command: yarn install --immutable
      - save_cache:
          name: Save Yarn Package Cache
          key: yarn-packages-{{ checksum "yarn.lock" }}
          paths:
            - ~/.cache/yarn

```

but I don’t understand where in the config.yaml it should go? or can I just use `pkg-manager: yarn` but again where in the config.yaml does it go?

Why didn’t circle ci detect i had a yarn.lock in the repo and give me the correct yaml to upload? It would have guaranteed success instead of failure when trying circle for the first time.

---

<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:** [January 17, 2021, 4:32pm UTC](https://discuss.circleci.com/t/restoring-cache-error/38811/2 "2021-01-17T16:32:03Z")

</div>

Hi @bkawk Welcome to the community!

I see you’re using the nodej orb which is a more stream lined way to implement functionality. The nodejs orb has functions that accomplishes what you’re attempting. Please checkout the nodejs orb docs specifically the `cache` elements in the [`install-packages`](https://circleci.com/developer/orbs/orb/circleci/node#commands-install-packages) orb command. The cache mechanisms for the can be controlled via those properties.

Also please provide more feedback on you’re experience. We’re very interested in feedback so we can continually improve functionality.

---

<div class="post-metadata">

**Author:** ![mkusold](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/mkusold/32/26559_2.png) [@mkusold](https://discuss.circleci.com/u/mkusold)\
**Post date:** [January 28, 2021, 11:48pm UTC](https://discuss.circleci.com/t/restoring-cache-error/38811/3 "2021-01-28T23:48:44Z")

</div>

So in your steps, make sure to have the `node/install-packages` `pkg-manager` option set to ‘yarn’ like so:

```auto
  steps:
      # Checkout the code as the first step.
      - checkout
      # Next, the node orb's install-packages step will install the dependencies from a package.json.
      # The orb install-packages step will also automatically cache them for faster future runs.
      - node/install-packages:
          pkg-manager: yarn
      - run:
          command: yarn test
          name: Run YARN tests

```

---

<div class="post-metadata">

**Author:** ![jaxsong](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/jaxsong/32/26561_2.png) [@jaxsong](https://discuss.circleci.com/u/jaxsong)\
**Post date:** [January 29, 2021, 7:32am UTC](https://discuss.circleci.com/t/restoring-cache-error/38811/4 "2021-01-29T07:32:15Z")

</div>

maybe, you should add package-lock.json to your repo 🙂
