{"id":1221,"date":"2021-06-29T10:16:40","date_gmt":"2021-06-29T08:16:40","guid":{"rendered":"https:\/\/nguenkam.com\/blog\/?p=1221"},"modified":"2021-11-03T14:45:03","modified_gmt":"2021-11-03T13:45:03","slug":"how-to-clear-the-cache-in-npm","status":"publish","type":"post","link":"https:\/\/nguenkam.com\/blog\/index.php\/2021\/06\/29\/how-to-clear-the-cache-in-npm\/","title":{"rendered":"How to clear the cache in npm"},"content":{"rendered":"\n<p>When we install a package using the<strong><em>&nbsp;<code>npm install &lt;package-name&gt;<\/code><\/em><\/strong>&nbsp;command, npm stores the cache inside the user file system.<\/p>\n\n\n\n<p>The default cache directory is&nbsp;<code>~\/.npm<\/code>&nbsp;on Posix (mac or linux), or&nbsp;<code>%AppData%\/npm-cache<\/code>&nbsp;on Windows.<\/p>\n\n\n\n<p>To see the right path of <strong>%AppData%<\/strong> in windows, you can use the <strong>set command <\/strong>(in the console with cmd ) to have a list of Environment variable.  Then look for &#8220;APPDATA&#8221; variable. ( APPDATA = C:\\Users\\ngubri\\AppData\\Roaming ) .<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h5>Clearing the cache<\/h5>\n\n\n\n<p>To clear a cache in npm, we need to run the<strong><em>&nbsp;<code>npm cache clean --force<\/code>&nbsp;<\/em><\/strong>command in our terminal.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>npm cache clean --force<\/code><\/pre>\n\n\n\n<p><strong>clean<\/strong>: It deletes the all data from your cache folder.<\/p>\n\n\n\n<p>You can also verify the cache, by running the following command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>npm cache verify<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>When we install a package using the&nbsp;npm install &lt;package-name&gt;&nbsp;command, npm stores the cache inside the user file system. The default cache directory is&nbsp;~\/.npm&nbsp;on Posix (mac or linux), or&nbsp;%AppData%\/npm-cache&nbsp;on Windows. To see the right path of %AppData% in windows, you can use the set command (in the console with cmd ) to have a list of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1342,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[343,342,344,184],"_links":{"self":[{"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1221"}],"collection":[{"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=1221"}],"version-history":[{"count":2,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1221\/revisions"}],"predecessor-version":[{"id":1343,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1221\/revisions\/1343"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/media\/1342"}],"wp:attachment":[{"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=1221"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=1221"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=1221"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}