<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Asad Rajput</title>
    <description>The latest articles on DEV Community by Asad Rajput (@asad_rajput_a2c67b9ede8c3).</description>
    <link>https://dev.to/asad_rajput_a2c67b9ede8c3</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4151083%2F09833aa8-87ef-4ea9-b878-fded297299f0.jpg</url>
      <title>DEV Community: Asad Rajput</title>
      <link>https://dev.to/asad_rajput_a2c67b9ede8c3</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/asad_rajput_a2c67b9ede8c3"/>
    <language>en</language>
    <item>
      <title>How to delete node_modules on Windows (safely, and for good)</title>
      <dc:creator>Asad Rajput</dc:creator>
      <pubDate>Tue, 29 Sep 2026 23:22:07 +0000</pubDate>
      <link>https://dev.to/asad_rajput_a2c67b9ede8c3/how-to-delete-nodemodules-on-windows-safely-and-for-good-fog</link>
      <guid>https://dev.to/asad_rajput_a2c67b9ede8c3/how-to-delete-nodemodules-on-windows-safely-and-for-good-fog</guid>
      <description>&lt;p&gt;If you've cloned more than a handful of JavaScript projects, there's a good chance tens of gigabytes of your drive are sitting inside folders named &lt;code&gt;node_modules&lt;/code&gt; — most of which you'll never open again. Here's how to find them, delete them safely, and avoid the errors that make this more annoying than it should be on Windows.&lt;/p&gt;

&lt;h2&gt;
  
  
  Is it safe to delete node_modules?
&lt;/h2&gt;

&lt;p&gt;Yes, in almost every case. &lt;code&gt;node_modules&lt;/code&gt; holds your project's installed dependencies, not your own code. Run &lt;code&gt;npm install&lt;/code&gt; (or &lt;code&gt;yarn&lt;/code&gt; / &lt;code&gt;pnpm install&lt;/code&gt;) again and it rebuilds from your &lt;code&gt;package.json&lt;/code&gt; and lockfile. The only time to pause is if you've manually edited a file inside &lt;code&gt;node_modules&lt;/code&gt; directly — rare, and usually a sign something else is wrong with the project anyway.&lt;/p&gt;

&lt;h2&gt;
  
  
  Method 1: File Explorer
&lt;/h2&gt;

&lt;p&gt;The obvious way — right-click the folder, choose Delete. It works, but it's slow on large dependency trees (some packages nest hundreds of small files), and it's the method most likely to hit the error in the next section.&lt;/p&gt;

&lt;h2&gt;
  
  
  Method 2: Command Prompt
&lt;/h2&gt;

&lt;p&gt;Faster than Explorer, and handles deeply nested folders better:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight batchfile"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="nb"&gt;path&lt;/span&gt;\to\your\project
&lt;span class="nb"&gt;rmdir&lt;/span&gt; &lt;span class="na"&gt;/s /q &lt;/span&gt;&lt;span class="kd"&gt;node_modules&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;/s&lt;/code&gt; removes all subfolders and files; &lt;code&gt;/q&lt;/code&gt; skips the "are you sure" prompts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Method 3: PowerShell
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;Remove-Item&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Recurse&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Force&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;\node_modules&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Functionally similar to the Command Prompt method. Use whichever terminal you already have open.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Getting a "path too long" or "access denied" error?&lt;/strong&gt; Windows historically capped file paths at 260 characters, and deeply nested node_modules folders (packages inside packages inside packages) blow past that easily. Two fixes: enable long path support by opening Group Policy Editor → Computer Configuration → Administrative Templates → System → Filesystem → "Enable Win32 long paths", or, faster, use &lt;code&gt;robocopy&lt;/code&gt; to overwrite the folder with an empty one first: &lt;code&gt;robocopy empty_folder node_modules /mir&lt;/code&gt;, then delete the now-empty result.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Method 4: npkill (finds every node_modules on your drive)
&lt;/h2&gt;

&lt;p&gt;If you have dozens of old projects scattered across your drive, hunting each one down manually isn't realistic. &lt;a href="https://www.npmjs.com/package/npkill" rel="noopener noreferrer"&gt;npkill&lt;/a&gt; is a free command-line tool that scans your drive, lists every &lt;code&gt;node_modules&lt;/code&gt; folder with its size, and lets you delete the ones you don't need interactively:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx npkill
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What about Docker, WSL, and everything else?
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;node_modules&lt;/code&gt; is usually just the beginning. Docker Desktop's virtual disk, WSL2's disk image, and build caches from tools like Webpack or Vite tend to grow quietly in the background too — and none of them show up clearly in Windows' own storage view.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;I'm exploring building a small tool that finds all of this in one scan — node_modules, Docker images, WSL bloat, build caches — classified as safe or not, cleared in a few clicks. Still early stage: &lt;a href="https://sweepdevv.netlify.app" rel="noopener noreferrer"&gt;sweepdevv.netlify.app&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>node</category>
      <category>windows</category>
      <category>javascript</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Docker Desktop taking too much space on Windows? Here's the fix</title>
      <dc:creator>Asad Rajput</dc:creator>
      <pubDate>Tue, 29 Sep 2026 23:19:50 +0000</pubDate>
      <link>https://dev.to/asad_rajput_a2c67b9ede8c3/docker-desktop-taking-too-much-space-on-windows-heres-the-fix-5ak1</link>
      <guid>https://dev.to/asad_rajput_a2c67b9ede8c3/docker-desktop-taking-too-much-space-on-windows-heres-the-fix-5ak1</guid>
      <description>&lt;p&gt;You've run &lt;code&gt;docker system prune&lt;/code&gt;, deleted old images, and your C: drive still hasn't gotten any smaller. This isn't a bug — it's how Docker Desktop's virtual disk works on Windows, and it needs one extra step to actually give the space back.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why prune isn't enough
&lt;/h2&gt;

&lt;p&gt;Docker Desktop on Windows runs on a WSL2 backend, storing all your images, containers, and volumes inside a single virtual disk file (a &lt;code&gt;.vhdx&lt;/code&gt;) — typically at:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;%LOCALAPPDATA%\Docker\wsl\disk\docker_data.vhdx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or, on older installs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;%USERPROFILE%\AppData\Local\Docker\wsl\data\ext4.vhdx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This file grows automatically as you pull images and build containers — but it doesn't shrink back down on its own when you delete things. Windows sees the file's maximum size, not how much of it is actually in use. Pruning frees space &lt;em&gt;inside&lt;/em&gt; the virtual disk; it doesn't return that space to your C: drive until you compact the file itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Clean up inside Docker first
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker system prune &lt;span class="nt"&gt;-a&lt;/span&gt; &lt;span class="nt"&gt;--volumes&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This removes unused containers, networks, dangling images, and volumes. Do this before compacting — there's no point shrinking a disk full of things you don't need.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Shut everything down
&lt;/h2&gt;

&lt;p&gt;The virtual disk can't be compacted while it's in use.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Right-click the Docker Desktop tray icon → Quit Docker Desktop&lt;/li&gt;
&lt;li&gt;Open Command Prompt or PowerShell and run: &lt;code&gt;wsl --shutdown&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 3: Compact the virtual disk
&lt;/h2&gt;

&lt;p&gt;If you're on Windows 10/11 Pro or Enterprise with the Hyper-V module available, open PowerShell &lt;strong&gt;as Administrator&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;cd&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$&lt;/span&gt;&lt;span class="nn"&gt;env&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nv"&gt;LOCALAPPDATA&lt;/span&gt;&lt;span class="s2"&gt;\Docker\wsl\disk"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;Optimize-VHD&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Path&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;\docker_data.vhdx&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Mode&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Full&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On Windows 10/11 Home, the Hyper-V module usually isn't available. Use &lt;code&gt;diskpart&lt;/code&gt; instead:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;diskpart
select vdisk file="C:\Users\YOURNAME\AppData\Local\Docker\wsl\disk\docker_data.vhdx"
attach vdisk readonly
compact vdisk
detach vdisk
exit
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Can't find the file, or it has a different name?&lt;/strong&gt; Docker has changed the exact folder layout across versions. Check both &lt;code&gt;%LOCALAPPDATA%\Docker\wsl\disk\&lt;/code&gt; and &lt;code&gt;%LOCALAPPDATA%\Docker\wsl\data\&lt;/code&gt; — the file will be named either &lt;code&gt;docker_data.vhdx&lt;/code&gt; or &lt;code&gt;ext4.vhdx&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Step 4: Restart Docker Desktop
&lt;/h2&gt;

&lt;p&gt;Open Docker Desktop normally — it will reattach to the (now smaller) virtual disk automatically.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prevent it from happening again
&lt;/h2&gt;

&lt;p&gt;In Docker Desktop, go to Settings → Resources → Advanced and set a disk size limit. It won't shrink the disk automatically for you, but it stops it from silently eating your entire drive between cleanups.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;I'm exploring building a small tool that catches this automatically — Docker's virtual disk, WSL bloat, and node_modules clutter, all in one scan instead of hunting each one down manually. Still early stage: &lt;a href="https://sweepdevv.netlify.app" rel="noopener noreferrer"&gt;sweepdevv.netlify.app&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>docker</category>
      <category>windows</category>
      <category>wsl</category>
      <category>devops</category>
    </item>
    <item>
      <title>WSL2 disk keeps growing? Here's how to shrink it</title>
      <dc:creator>Asad Rajput</dc:creator>
      <pubDate>Tue, 29 Sep 2026 23:15:24 +0000</pubDate>
      <link>https://dev.to/asad_rajput_a2c67b9ede8c3/wsl2-disk-keeps-growing-heres-how-to-shrink-it-3j8c</link>
      <guid>https://dev.to/asad_rajput_a2c67b9ede8c3/wsl2-disk-keeps-growing-heres-how-to-shrink-it-3j8c</guid>
      <description>&lt;p&gt;If you use WSL2 for any length of time, you've probably noticed this: you delete files, clear caches, even uninstall packages inside your Linux distro — and your Windows C: drive usage doesn't move. This trips up almost everyone, and it's not something you did wrong.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why this happens
&lt;/h2&gt;

&lt;p&gt;Every WSL2 distro lives inside its own virtual disk file (a &lt;code&gt;.vhdx&lt;/code&gt;), usually somewhere under:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;C:\Users\YOURNAME\AppData\Local\Packages\CanonicalGroupLimited...\LocalState\ext4.vhdx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These disks are "dynamically expanding" — they grow automatically as you use space inside the distro, but Windows never shrinks them back down on its own, even after you delete files from inside Linux. The freed space becomes available to the distro again, but not back to your Windows C: drive, until you compact the file manually.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Shut down WSL completely
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wsl &lt;span class="nt"&gt;--shutdown&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Confirm everything actually stopped:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wsl &lt;span class="nt"&gt;-l&lt;/span&gt; &lt;span class="nt"&gt;-v&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every distro listed should show &lt;code&gt;Stopped&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Find your distro's vhdx file
&lt;/h2&gt;

&lt;p&gt;The exact path depends on which distro you're running. For most Linux distros installed from the Microsoft Store, it's under:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;%LOCALAPPDATA%\Packages\&amp;lt;DistroFolderName&amp;gt;\LocalState\ext4.vhdx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(If you're specifically dealing with Docker Desktop's disk rather than a Linux distro, the process is nearly identical but the file lives in a different folder — &lt;code&gt;%LOCALAPPDATA%\Docker\wsl\disk\docker_data.vhdx&lt;/code&gt;.)&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Compact the disk
&lt;/h2&gt;

&lt;p&gt;On Windows 10/11 Pro or Enterprise, open PowerShell &lt;strong&gt;as Administrator&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;Optimize-VHD&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Path&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"C:\path\to\ext4.vhdx"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Mode&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Full&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On Windows 10/11 Home, the Hyper-V module isn't available by default, so use &lt;code&gt;diskpart&lt;/code&gt; instead:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;diskpart
select vdisk file="C:\path\to\ext4.vhdx"
attach vdisk readonly
compact vdisk
detach vdisk
exit
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Want to actually reclaim a large amount of space?&lt;/strong&gt; Compacting only returns space Linux itself has already marked as free. If your distro's disk is genuinely full of unused packages, logs, or old Docker layers, clean those up from inside WSL first — then shut down and compact. Compacting an already-full disk won't do much.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Step 4: Restart
&lt;/h2&gt;

&lt;p&gt;Just open a terminal into your distro again, or start Docker Desktop — WSL restarts itself automatically on first use.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prevent it from growing unchecked
&lt;/h2&gt;

&lt;p&gt;You can cap how much a distro's disk is allowed to grow by editing &lt;code&gt;%USERPROFILE%\.wslconfig&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="nn"&gt;[wsl2]&lt;/span&gt;
&lt;span class="py"&gt;memory&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;6GB&lt;/span&gt;
&lt;span class="py"&gt;processors&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;4&lt;/span&gt;
&lt;span class="py"&gt;swap&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This limits memory and CPU rather than disk size directly, but keeping WSL's resource usage in check tends to slow down how fast the disk fills in the first place — most growth comes from Docker layers and package caches building up over time.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;I'm exploring building a small tool that finds this kind of thing automatically — WSL and Docker virtual disks, node_modules, build caches — across your whole drive instead of hunting for each one manually. Still early stage, but if you're curious: &lt;a href="https://sweepdevv.netlify.app" rel="noopener noreferrer"&gt;sweepdevv.netlify.app&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>windows</category>
      <category>wsl</category>
      <category>docker</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
