npm-install icon indicating copy to clipboard operation
npm-install copied to clipboard

Q: `useRollingCache: true` still results in `npm ci`, but `npm ci` removes `node_modules`?

Open wooorm opened this issue 4 years ago • 2 comments

I’m trying to make a build (mdx-js/mdx) much faster, and am testing useRollingCache: true. It doesn’t seem to do much. Could that be because it still uses npm ci (proof from workflow), but npm ci is faster if:

  • The node_modules folder is missing or empty.

due to:

  • If a node_modules is already present, it will be automatically removed before npm ci begins its install.

(citations from npm ci docs)

(see also this post by De Voorhoede)

wooorm avatar Sep 14 '21 16:09 wooorm

Came here to say the same thing. What is the point of the caching feature, if npm ci nukes the entire node_modules every time?

moltar avatar Jul 13 '22 15:07 moltar

As documented, folder ~/.npm or ~/.cache/yarn will be cached. So, npm will first check its local cache before querying the npm registry when you execute npm ci.

d-werner avatar Sep 22 '22 11:09 d-werner