{"id":3764,"date":"2022-09-12T14:43:14","date_gmt":"2022-09-12T05:43:14","guid":{"rendered":"https:\/\/blog.wsd.sh\/?p=3764"},"modified":"2022-09-14T10:00:39","modified_gmt":"2022-09-14T01:00:39","slug":"how-to-clean-cache-in-next-js","status":"publish","type":"post","link":"https:\/\/blog.wsd.sh\/?p=3764","title":{"rendered":"<small>How to clean cache in Next.js<\/small>"},"content":{"rendered":"<p>1. Anser<br \/>\n&#8211; yarn cache clean<br \/>\n&#8211; rm -rf node_modules\/<br \/>\n&#8211; rm -rf .next\/<\/p>\n<p>2. Reference<br \/>\n<a href=\"https:\/\/stackoverflow.com\/questions\/69084610\/how-to-clean-cache-in-next-js-react-chrome\">https:\/\/stackoverflow.com\/questions\/69084610\/how-to-clean-cache-in-next-js-react-chrome<\/a><\/p>\n<p>3. Confirm used disk size<\/p>\n<pre>\r\n$ df\r\nFilesystem     1K-blocks      Used Available Use% Mounted on\r\ntmpfs             802196      1972    800224   1% \/run\r\n\/dev\/sda2      503115808 179234908 298250540  38% \/\r\ntmpfs            4010972     62128   3948844   2% \/dev\/shm\r\ntmpfs               5120         4      5116   1% \/run\/lock\r\n\/dev\/sda1         523244      5364    517880   2% \/boot\/efi\r\ntmpfs             802192      4760    797432   1% \/run\/user\/1000\r\n<\/pre>\n<p>4. Yarn cache clean<\/p>\n<pre>\r\n$ yarn cache clean\r\nyarn cache v1.22.19\r\nsuccess Cleared cache.\r\nDone in 8.29s.\r\n<\/pre>\n<pre>\r\n$ df\r\nFilesystem     1K-blocks      Used Available Use% Mounted on\r\ntmpfs             802196      1972    800224   1% \/run\r\n\/dev\/sda2      503115808 176441744 301043704  37% \/\r\ntmpfs            4010972     61872   3949100   2% \/dev\/shm\r\ntmpfs               5120         4      5116   1% \/run\/lock\r\n\/dev\/sda1         523244      5364    517880   2% \/boot\/efi\r\ntmpfs             802192      4760    797432   1% \/run\/user\/1000\r\n$\r\n<\/pre>\n<p>5. Remove the whole node_modules<\/p>\n<pre>\r\n$ rm -rf node_modules\/\r\n<\/pre>\n<pre>\r\n$ df\r\nFilesystem     1K-blocks      Used Available Use% Mounted on\r\ntmpfs             802196      1972    800224   1% \/run\r\n\/dev\/sda2      503115808 175907464 301577984  37% \/\r\ntmpfs            4010972     61872   3949100   2% \/dev\/shm\r\ntmpfs               5120         4      5116   1% \/run\/lock\r\n\/dev\/sda1         523244      5364    517880   2% \/boot\/efi\r\ntmpfs             802192      4760    797432   1% \/run\/user\/1000\r\n$ \r\n<\/pre>\n<p>6. Re install node modues <\/p>\n<pre>\r\n$ yarn\r\n<\/pre>\n<p>7. Comfirm execute<br \/>\n&#8211; ok<\/p>\n<pre>\r\n$ npm run dev\r\n<\/pre>\n<p>8. Confirm used disk size<\/p>\n<pre>\r\n$ df\r\nFilesystem     1K-blocks      Used Available Use% Mounted on\r\ntmpfs             802196      1972    800224   1% \/run\r\n\/dev\/sda2      503115808 177697888 299787560  38% \/\r\ntmpfs            4010972     61872   3949100   2% \/dev\/shm\r\ntmpfs               5120         4      5116   1% \/run\/lock\r\n\/dev\/sda1         523244      5364    517880   2% \/boot\/efi\r\ntmpfs             802192      4760    797432   1% \/run\/user\/1000\r\n$\r\n<\/pre>\n<p>9. Delete .next\/<\/p>\n<pre>\r\n$ rm -rf .next\/\r\n<\/pre>\n<p>10. Confirm used disk size<\/p>\n<pre>\r\n$ df\r\nFilesystem     1K-blocks      Used Available Use% Mounted on\r\ntmpfs             802196      1972    800224   1% \/run\r\n\/dev\/sda2      503115808 174595404 302890044  37% \/\r\ntmpfs            4010972     61872   3949100   2% \/dev\/shm\r\ntmpfs               5120         4      5116   1% \/run\/lock\r\n\/dev\/sda1         523244      5364    517880   2% \/boot\/efi\r\ntmpfs             802192      4760    797432   1% \/run\/user\/1000\r\n$\r\n<\/pre>\n<p>11. Comfirm execute<br \/>\n&#8211; ok<\/p>\n<pre>\r\n$ npm run dev\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>1. Anser &#8211; yarn cache clean &#8211; rm -rf node_modules\/ &#8211; rm -rf .next\/ 2. Reference https:\/\/stac&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=\/wp\/v2\/posts\/3764"}],"collection":[{"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3764"}],"version-history":[{"count":19,"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=\/wp\/v2\/posts\/3764\/revisions"}],"predecessor-version":[{"id":3892,"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=\/wp\/v2\/posts\/3764\/revisions\/3892"}],"wp:attachment":[{"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3764"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3764"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3764"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}