How to enable eslint caching?

I’m trying to enable eslint caching, following this part of the user guide

My command is npm run lint -- --cache=true, and the lint script just runs a script that spawns esw (which itself just runs eslint — we have v7.x installed) as a child process.

From earlier in the user guide

Caching:
  --cache                         Only check changed files - default: false
  --cache-file path::String       Path to the cache file. Deprecated: use --cache-location - default: .eslintcache
  --cache-location path::String   Path to the cache file or directory
  --cache-strategy String         Strategy to use for detecting changed files in the cache - either: metadata or content - default: metadata

But when I run the command I get:

npm WARN invalid config cache=true
npm WARN invalid config Must be a valid filesystem path

Even supplying a --cache-location=.eslintcache doesn’t change the error message.

How am I supposed to enable caching?