docs: caching node_modules vs cache directory
See original GitHub issueThe docs guides to cache .npm
or $(yarn cache dir)
for nodejs.
This lets people feel it the “RIGHT” way to cache node dependencies, without clearly explaining whether caching node_modules
directly is not recommended.
I want to know 1) if this is a wrong impression or not and 2) why.
Thanks!
Issue Analytics
- State:
- Created 2 years ago
- Reactions:7
- Comments:6
Top Results From Across the Web
npm-cache
This directory is a cacache -based content-addressable cache that stores all http request data as well as other package-related data. This directory is ......
Read more >Caching dependencies to speed up workflows - GitHub Docs
To make your workflows faster and more efficient, you can create and use caches for dependencies and other commonly reused files.
Read more >Caching in GitLab CI/CD
By default, npm stores cache data in the home folder ( ~/.npm ). ... PHP libraries modules are installed in vendor/ and are...
Read more >Caching Dependencies - CircleCI
A cache stores a hierarchy of files under a key. Use the cache to store data that makes your job faster, but, in...
Read more >Caching Dependencies and Directories - Travis CI Docs
Caches lets Travis CI store directories between builds, which is useful for ... This caches $HOME/.npm or node_modules , depending on the repository's ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes. I would like to know the answer here as well. From experience caching
node_modules/
saves a lot more time, than just caching$(yarn cache dir)
🤔In my github workflow here are my results from different caching strategies vs no-caching:
yarn install
- no-cachingyarn install
- cache hit$(yarn cache dir)
yarn install
- cache hitnode_modules/
Up to 60x faster when caching
node_modules/
directly vs caching$(yarn cache dir)
🤔This has already been added to Node example at https://github.com/actions/cache/blob/main/examples.md#node---npm . Hence, going ahead and closing this. Thank you for opening this issue.