# How do I cache node\_modules between builds

**URL:** <https://drone.discourse.group/t/how-do-i-cache-node-modules-between-builds/11376>\
**Category:** Drone Support\
**Created:** [March 16, 2018, 3:15pm UTC](https://drone.discourse.group/t/how-do-i-cache-node-modules-between-builds/11376 "2018-03-16T15:15:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![penx](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/penx/32/3995_2.png) [@penx](https://drone.discourse.group/u/penx)\
**Post date:** [March 16, 2018, 3:15pm UTC](https://drone.discourse.group/t/how-do-i-cache-node-modules-between-builds/11376/1 "2018-03-16T15:15:42Z")

</div>

I’ve read the docs but cannot find a full example yml file of how to configure Drone for caching.

I have the following:

```auto
---
cache:
  mount:
    - node_modules
    - .git
pipeline:
  build:
    commands:
      - yarn
      - "yarn bootstrap"
      - "yarn build"
      - "yarn test"
    image: "node:8"

```

But get the error “Failed to unmarshal Stringorslice”

Can someone please post a working config?

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [March 16, 2018, 3:27pm UTC](https://drone.discourse.group/t/how-do-i-cache-node-modules-between-builds/11376/2 "2018-03-16T15:27:45Z")

</div>

Caching is handled by plugins.

Here is an example of a plugin that will restore and update a cache using s3 / minio / anything compatible with the s3 protocol:  
[http://plugins.drone.io/drone-plugins/drone-s3-cache/](http://plugins.drone.io/drone-plugins/drone-s3-cache/)

Here is an example of a plugin that will cache to a local volume on the host machine:  
[http://plugins.drone.io/drillster/drone-volume-cache/](http://plugins.drone.io/drillster/drone-volume-cache/)

Here is a plugin that caches to a remote server using sftp:  
[http://plugins.drone.io/appleboy/drone-sftp-cache/](http://plugins.drone.io/appleboy/drone-sftp-cache/)

And you always have the option to write your own custom plugins, if none of the above caching plugins meet your needs. We have a library available to help develop caching plugins. See [https://github.com/drone/drone-cache-lib](https://github.com/drone/drone-cache-lib)
