<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Node on Brandon Pugh&#39;s Blog</title>
    <link>https://www.brandonpugh.com/tags/node/</link>
    <description>Recent content in Node on Brandon Pugh&#39;s Blog</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Thu, 21 May 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://www.brandonpugh.com/tags/node/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>NPM 11.10.0 adds `min-release-age`</title>
      <link>https://www.brandonpugh.com/til/node/package-version-cooldown/</link>
      <pubDate>Thu, 21 May 2026 00:00:00 +0000</pubDate>
      <guid>https://www.brandonpugh.com/til/node/package-version-cooldown/</guid>
      <description>&lt;p&gt;You can now specify a minimum age for installing package versions in NPM.&lt;/p&gt;
&lt;p&gt;This is a concept known as &lt;a href=&#34;https://cooldowns.dev/&#34;&gt;dependency cooldowns&lt;/a&gt; that has gained popularity with the rise in supply chain attacks.&lt;/p&gt;
&lt;p&gt;You need to be running at least &lt;a href=&#34;https://github.com/npm/cli/releases/tag/v11.10.0&#34;&gt;v11.10.0 of npm&lt;/a&gt; but then you can add the following to your &lt;code&gt;.npmrc&lt;/code&gt; file:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-inf&#34; data-lang=&#34;inf&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;na&#34;&gt;min-release-age&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;7&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;or set it globally with:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;npm config &lt;span class=&#34;nb&#34;&gt;set&lt;/span&gt; min-release-age&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;m&#34;&gt;7&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now NPM won&amp;rsquo;t install any package version that was released less than 7 days ago.&lt;/p&gt;
&lt;p&gt;If you don&amp;rsquo;t specify a version, i.e. &lt;code&gt;npm install vite&lt;/code&gt;, then it will install the most recent version that satisfies the age requirement.&lt;/p&gt;
&lt;p&gt;If you specify a version that doesn&amp;rsquo;t meet the age requirement then it will error out.&lt;/p&gt;
&lt;p&gt;Note: if you&amp;rsquo;re running a version of NPM older than 11.10 then it will silently ignore the new config value.&lt;/p&gt;

       &lt;hr&gt; &lt;p&gt;Thank you for keeping RSS alive. You&#39;re awesome.&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;mailto:blogrss@bpugh.dev&#34;&gt;Reply by email&lt;/a&gt;&lt;/p&gt;
        &lt;img src=&quot;https://blog.bpugh.workers.dev/cdn/images?p=/til/node/package-version-cooldown/feed&quot;&gt;
      </description>
    </item>
    
    <item>
      <title>List installed node versions with Volta</title>
      <link>https://www.brandonpugh.com/til/node/volta-list/</link>
      <pubDate>Tue, 12 May 2026 00:00:00 +0000</pubDate>
      <guid>https://www.brandonpugh.com/til/node/volta-list/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://volta.sh/&#34;&gt;Volta&lt;/a&gt; is my preferred node version manager these days but the commands are a bit different to what I&amp;rsquo;m used to.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;volta list&lt;/code&gt; - show the current tool versions in use&lt;/li&gt;
&lt;li&gt;&lt;code&gt;volta list node&lt;/code&gt; - show all the versions of node downloaded to the machine&lt;/li&gt;
&lt;li&gt;&lt;code&gt;volta install node@version&lt;/code&gt; - use the specified version of node. It will download and install it if hasn&amp;rsquo;t before otherwise it will just select it (there is no separate &lt;code&gt;use&lt;/code&gt; command).&lt;/li&gt;
&lt;/ul&gt;

       &lt;hr&gt; &lt;p&gt;Thank you for keeping RSS alive. You&#39;re awesome.&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;mailto:blogrss@bpugh.dev&#34;&gt;Reply by email&lt;/a&gt;&lt;/p&gt;
        &lt;img src=&quot;https://blog.bpugh.workers.dev/cdn/images?p=/til/node/volta-list/feed&quot;&gt;
      </description>
    </item>
    
    <item>
      <title>Run old versions of Angular</title>
      <link>https://www.brandonpugh.com/til/node/old-project-versions/</link>
      <pubDate>Thu, 20 Mar 2025 00:00:00 +0000</pubDate>
      <guid>https://www.brandonpugh.com/til/node/old-project-versions/</guid>
      <description>&lt;p&gt;Today I learned how to get a very old Angular project running locally.
Even though it was Angular in this case, the steps are likely to be similar for most aging node based projects.&lt;/p&gt;
&lt;p&gt;First I had to go to the &lt;a href=&#34;https://angular.dev/reference/versions&#34;&gt;Version compatibility&lt;/a&gt; page for Angular and find the required version of node.
In my case it was Angular v7 so I needed Node v10.&lt;/p&gt;
&lt;p&gt;Next, you&amp;rsquo;ll want to use a version manager for node.&lt;br&gt;
nvm is the most well known but you have to run it in bash on Windows and I find &lt;a href=&#34;https://volta.sh/&#34;&gt;Volta&lt;/a&gt; much nicer to use.&lt;/p&gt;
&lt;p&gt;I ran &lt;code&gt;volta pin node@10&lt;/code&gt; in the project directory.
This will add a &lt;code&gt;volta&lt;/code&gt; config section to the package.json so that whenever you&amp;rsquo;re in that directory, you&amp;rsquo;ll automatically use the correct version of node and npm.&lt;/p&gt;
&lt;p&gt;Best of all though, it won&amp;rsquo;t affect the default version of node that get&amp;rsquo;s run everywhere else.&lt;/p&gt;
&lt;p&gt;Also make sure you run &lt;code&gt;npm install&lt;/code&gt; &lt;em&gt;after&lt;/em&gt; the above command so that it&amp;rsquo;s the correct version of &lt;code&gt;npm&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;If you already tried to run &lt;code&gt;npm i&lt;/code&gt; with a different version of node then you&amp;rsquo;ll probably need to blow away your &lt;code&gt;node_modules&lt;/code&gt; folder and try again (ask me how I know).&lt;/p&gt;

       &lt;hr&gt; &lt;p&gt;Thank you for keeping RSS alive. You&#39;re awesome.&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;mailto:blogrss@bpugh.dev&#34;&gt;Reply by email&lt;/a&gt;&lt;/p&gt;
        &lt;img src=&quot;https://blog.bpugh.workers.dev/cdn/images?p=/til/node/old-project-versions/feed&quot;&gt;
      </description>
    </item>
    
    <item>
      <title>npmpackage.info</title>
      <link>https://www.brandonpugh.com/til/node/npm-package-info/</link>
      <pubDate>Thu, 30 Jan 2025 00:00:00 +0000</pubDate>
      <guid>https://www.brandonpugh.com/til/node/npm-package-info/</guid>
      <description>&lt;p&gt;I recently discovered this handy site that aggregates all usual info I tend to look at when deciding whether or not I want to pull in an NPM package as a dependency.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://npmpackage.info/package/react-datepicker?t=overview&#34;&gt;npmpackage.info&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Some things I tend to look at:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;When was the last version published?&lt;/li&gt;
&lt;li&gt;How many sub-dependencies does it have?
&lt;ul&gt;
&lt;li&gt;With the rise in supply chain attacks, newer packages try to minimize these with some advertising zero dependencies&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;How much will it add to bundle size?
&lt;ul&gt;
&lt;li&gt;I usually check &lt;a href=&#34;https://bundlephobia.com/&#34;&gt;Bundlephobia&lt;/a&gt; and this displays the stats from there along with everything else&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;How widely used is it?&lt;/li&gt;
&lt;/ul&gt;

       &lt;hr&gt; &lt;p&gt;Thank you for keeping RSS alive. You&#39;re awesome.&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;mailto:blogrss@bpugh.dev&#34;&gt;Reply by email&lt;/a&gt;&lt;/p&gt;
        &lt;img src=&quot;https://blog.bpugh.workers.dev/cdn/images?p=/til/node/npm-package-info/feed&quot;&gt;
      </description>
    </item>
    
    <item>
      <title>Fix package-lock.json merge conflicts</title>
      <link>https://www.brandonpugh.com/til/node/package-lock-conflicts/</link>
      <pubDate>Tue, 16 Jan 2024 00:00:00 +0000</pubDate>
      <guid>https://www.brandonpugh.com/til/node/package-lock-conflicts/</guid>
      <description>&lt;p&gt;Today I learned that npm can handle merge conflicts in your &lt;code&gt;package-lock.json&lt;/code&gt; file for you.&lt;/p&gt;
&lt;p&gt;After you resolve any merge conflicts in your &lt;code&gt;package.json&lt;/code&gt;, you can just run &lt;code&gt;npm install [--package-lock-only]&lt;/code&gt; and npm will resolve the conflicts in the lock file.
If &lt;code&gt;--package-lock-only&lt;/code&gt; is provided, it will do this without also modifying your local &lt;code&gt;node_modules/&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://tkdodo.eu/blog/solving-conflicts-in-package-lock-json&#34;&gt;Solving conflicts in package-lock.json&lt;/a&gt;&lt;/p&gt;

       &lt;hr&gt; &lt;p&gt;Thank you for keeping RSS alive. You&#39;re awesome.&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;mailto:blogrss@bpugh.dev&#34;&gt;Reply by email&lt;/a&gt;&lt;/p&gt;
        &lt;img src=&quot;https://blog.bpugh.workers.dev/cdn/images?p=/til/node/package-lock-conflicts/feed&quot;&gt;
      </description>
    </item>
    
    <item>
      <title>Native node import path aliases</title>
      <link>https://www.brandonpugh.com/til/node/import-aliases/</link>
      <pubDate>Wed, 08 Nov 2023 00:00:00 +0000</pubDate>
      <guid>https://www.brandonpugh.com/til/node/import-aliases/</guid>
      <description>&lt;p&gt;Today I learned that node natively supports import path aliases with the &lt;a href=&#34;https://nodejs.org/api/packages.html#imports&#34;&gt;imports field&lt;/a&gt; in &lt;code&gt;package.json&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The nice thing about this is that they&amp;rsquo;re supported by most node tools now so you don&amp;rsquo;t need to configure your aliases separately in different tools like eslint, webpack, vite, etc&amp;hellip;&lt;/p&gt;
&lt;p&gt;If you&amp;rsquo;re not familiar with import aliases, they&amp;rsquo;re a handy way to avoid unwieldy relative import paths.&lt;/p&gt;
&lt;p&gt;instead of:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-js&#34; data-lang=&#34;js&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kr&#34;&gt;import&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;utils&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;from&lt;/span&gt; &lt;span class=&#34;s1&#34;&gt;&amp;#39;../../../../shared/utils&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;you can have:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-js&#34; data-lang=&#34;js&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kr&#34;&gt;import&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;utils&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;from&lt;/span&gt; &lt;span class=&#34;s1&#34;&gt;&amp;#39;#shared/utils&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A nice config to start with is something similar to:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-json&#34; data-lang=&#34;json&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;imports&amp;#34;&lt;/span&gt;&lt;span class=&#34;err&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nt&#34;&gt;&amp;#34;#*&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;./*&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;err&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;which lets you import anything from the root of your project.&lt;/p&gt;
&lt;p&gt;I actually discovered this from looking through the &lt;a href=&#34;https://github.com/epicweb-dev/epic-stack/blob/main/docs/decisions/031-imports.md&#34;&gt;decision log&lt;/a&gt; of the &lt;a href=&#34;https://github.com/epicweb-dev/epic-stack&#34;&gt;&lt;code&gt;epic-stack&lt;/code&gt;&lt;/a&gt; react project.&lt;/p&gt;
&lt;p&gt;Unfortunately typescript doesn&amp;rsquo;t support it yet (though it&amp;rsquo;s planned), so you&amp;rsquo;d still need to update &lt;code&gt;tsconfig.json&lt;/code&gt; with:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-json&#34; data-lang=&#34;json&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;paths&amp;#34;&lt;/span&gt;&lt;span class=&#34;err&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;      &lt;span class=&#34;nt&#34;&gt;&amp;#34;#*&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;./*&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;],&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;err&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
       &lt;hr&gt; &lt;p&gt;Thank you for keeping RSS alive. You&#39;re awesome.&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;mailto:blogrss@bpugh.dev&#34;&gt;Reply by email&lt;/a&gt;&lt;/p&gt;
        &lt;img src=&quot;https://blog.bpugh.workers.dev/cdn/images?p=/til/node/import-aliases/feed&quot;&gt;
      </description>
    </item>
    
    <item>
      <title>Override nested dependencies with npm</title>
      <link>https://www.brandonpugh.com/til/node/npm-overrides/</link>
      <pubDate>Mon, 06 Nov 2023 00:00:00 +0000</pubDate>
      <guid>https://www.brandonpugh.com/til/node/npm-overrides/</guid>
      <description>&lt;p&gt;Today I learned that as of npm cli v8.3.0 (2021-12-09), you can use the &lt;a href=&#34;https://docs.npmjs.com/cli/v9/configuring-npm/package-json#overrides&#34;&gt;overrides field&lt;/a&gt; in &lt;code&gt;package.json&lt;/code&gt; to &amp;ldquo;override&amp;rdquo; nested dependency versions.&lt;/p&gt;
&lt;p&gt;This is handy for several scenarios, but for me I used for a third-party react component that has a &lt;code&gt;peerDependency&lt;/code&gt; on v16 of react even though it works just fine with v18 but it isn&amp;rsquo;t under active development at the moment so I had to override the version it accepts:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-json&#34; data-lang=&#34;json&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;s2&#34;&gt;&amp;#34;overrides&amp;#34;&lt;/span&gt;&lt;span class=&#34;err&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nt&#34;&gt;&amp;#34;react-input-range&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;      &lt;span class=&#34;nt&#34;&gt;&amp;#34;react-dom&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;^18.2.0&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;      &lt;span class=&#34;nt&#34;&gt;&amp;#34;react&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;^18.2.0&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;err&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Yarn has similar functionality that it calls &lt;a href=&#34;https://classic.yarnpkg.com/lang/en/docs/selective-version-resolutions/&#34;&gt;resolutions&lt;/a&gt;.&lt;/p&gt;

       &lt;hr&gt; &lt;p&gt;Thank you for keeping RSS alive. You&#39;re awesome.&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;mailto:blogrss@bpugh.dev&#34;&gt;Reply by email&lt;/a&gt;&lt;/p&gt;
        &lt;img src=&quot;https://blog.bpugh.workers.dev/cdn/images?p=/til/node/npm-overrides/feed&quot;&gt;
      </description>
    </item>
    
  </channel>
</rss>