<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Node on Nelson Figueroa</title><link>https://nelson.cloud/categories/node/</link><description>Recent content in Node on Nelson Figueroa</description><image><title>Nelson Figueroa</title><url>https://nelson.cloud/opengraph-images/default.png</url><link>https://nelson.cloud/opengraph-images/default.png</link></image><language>en</language><lastBuildDate>Sat, 24 Jan 2026 16:22:37 -0800</lastBuildDate><atom:link href="https://nelson.cloud/categories/node/index.xml" rel="self" type="application/rss+xml"/><item><title>Delete All node_modules Directories Recursively in macOS and Linux</title><link>https://nelson.cloud/delete-all-node_modules-directories-recursively-in-macos-and-linux/?ref=rss</link><pubDate>Sun, 14 May 2023 00:00:00 +0000</pubDate><guid>https://nelson.cloud/delete-all-node_modules-directories-recursively-in-macos-and-linux/?ref=rss</guid><description>How to delete all node_modules directories recursively in macOS and Linux systems.</description><content:encoded><![CDATA[<p>We can use the <code>find</code> command to delete a specific directory recursively. This is the command formula:</p>
<div class="highlight"><span class="code-lang">Shell</span><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">find /path/to/starting/directory/ -type d -name <span class="s2">&#34;directory_to_delete&#34;</span> -exec rm -rf <span class="o">{}</span> <span class="se">\;</span></span></span></code></pre></div><p>For example, if we wanted to delete all <code>node_modules</code> directories within the path <code>/projects/javascript/</code>, we would run:</p>
<div class="highlight"><span class="code-lang">Shell</span><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">find /projects/javascript/ -type d -name <span class="s2">&#34;node_modules&#34;</span> -exec rm -rf <span class="o">{}</span> <span class="se">\;</span></span></span></code></pre></div><blockquote><p><strong>Note:</strong></p><p>Sometimes the output says:</p>
<div class="highlight"><span class="code-lang">Text</span><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">find: ./node_modules: No such file or directory</span></span></code></pre></div><p>But the command should still work.</p>
</blockquote>

<p>If you look closely, we&rsquo;re really just executing a command against all <code>node_modules</code> directories in the <code>/projects/javascript/</code> directory (<code>rm -rf</code>). This command can be modified to execute other commands against all <code>node_modules</code> directories, but that is out of the scope of this post :)</p>
]]></content:encoded></item></channel></rss>