How do I cache node_modules between builds

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

I have the following:

---
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?

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/

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/

Here is a plugin that caches to a remote server using sftp:
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