npm Cache

Feb 13, 2025 · 1 min read · 114 Words · -Views -Comments · Programming
Node.js 🇨🇳 阅读中文版
Read with AI

Choose an AI assistant

ChatGPT Open in a new tab with the article link and prompt
Claude Copy the prompt, then open Claude

Open Claude
Trouble reading the article?

If the prompt is missing, copy the full prompt below into your AI assistant. If the AI cannot read the article, paste the visible passage you want to discuss and add your question.

When developing with npm, you may notice that if you delete the node_modules folder and then reinstall dependencies, the installation is very fast. This is because npm has a caching mechanism.

What is npm Cache

npm cache is a mechanism where npm downloads dependency packages to a local cache directory during installation. The next time you install, if the dependency package already exists in the cache directory, npm retrieves it directly from the cache instead of downloading it again.

How to View npm Cache


npm config get cache

npm cache ls

Cache Directories for Different Package Managers

Package ManagerCache Directory
Maven/root/.m2/
Gradle/root/.gradle/
npm/root/.npm/
composer/root/.cache/composer/
yarn/usr/local/share/.cache/yarn/

Final Thoughts

Done.

Authors
Developer, digital product enthusiast, tinkerer, sharer, open source lover