<?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>Forem: Matías Denda</title>
    <description>The latest articles on Forem by Matías Denda (@matutetandil).</description>
    <link>https://forem.com/matutetandil</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3601966%2F6aebccb4-b6ac-40c9-98c1-0eb5fa97d314.png</url>
      <title>Forem: Matías Denda</title>
      <link>https://forem.com/matutetandil</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/matutetandil"/>
    <language>en</language>
    <item>
      <title>Automatic Node.js Version Switching Across Projects</title>
      <dc:creator>Matías Denda</dc:creator>
      <pubDate>Fri, 07 Nov 2025 21:21:15 +0000</pubDate>
      <link>https://forem.com/matutetandil/automatic-nodejs-version-switching-across-projects-2dae</link>
      <guid>https://forem.com/matutetandil/automatic-nodejs-version-switching-across-projects-2dae</guid>
      <description>&lt;h1&gt;
  
  
  The Challenge
&lt;/h1&gt;

&lt;p&gt;Modern JavaScript development often involves working on multiple projects simultaneously. Each project may require a different Node.js version:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Legacy project: Node 14&lt;/li&gt;
&lt;li&gt;Production app: Node 18 LTS&lt;/li&gt;
&lt;li&gt;New experimental project: Node 20&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Manually switching versions between projects adds friction to your workflow. You need to remember which version each project uses and run the appropriate commands when switching contexts.&lt;/p&gt;

&lt;h1&gt;
  
  
  What is AutoNode?
&lt;/h1&gt;

&lt;p&gt;AutoNode is a CLI tool that automatically detects and switches to the correct Node.js version when you navigate between projects. It works seamlessly with your existing version manager (nvm, nvs, or Volta).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key features:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🔍 Automatic version detection from multiple sources&lt;/li&gt;
&lt;li&gt;⚡ Zero runtime dependencies (single native binary)&lt;/li&gt;
&lt;li&gt;🔄 Works with your existing version manager&lt;/li&gt;
&lt;li&gt;🌍 Cross-platform (macOS, Linux, Windows)&lt;/li&gt;
&lt;li&gt;📦 Under 6MB with everything included&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How It Works
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Version Detection
&lt;/h3&gt;

&lt;p&gt;AutoNode reads version requirements from multiple sources (in priority order):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;.nvmrc&lt;/code&gt;&lt;/strong&gt; - Standard nvm configuration file&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;.node-version&lt;/code&gt;&lt;/strong&gt; - Alternative version file format&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;package.json&lt;/code&gt;&lt;/strong&gt; - Reads &lt;code&gt;engines.node&lt;/code&gt; field&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;Dockerfile&lt;/code&gt;&lt;/strong&gt; - Parses &lt;code&gt;FROM node:X&lt;/code&gt; declarations&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This multi-source approach ensures compatibility with different project conventions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Shell Integration
&lt;/h3&gt;

&lt;p&gt;When you &lt;code&gt;cd&lt;/code&gt; into a project directory, AutoNode:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Detects the required Node.js version&lt;/li&gt;
&lt;li&gt;Checks which version manager you have installed&lt;/li&gt;
&lt;li&gt;Switches to the appropriate version automatically&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The integration works through a shell hook similar to other developer tools like direnv or starship.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;One-line install:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://raw.githubusercontent.com/matutetandil/autonode/main/install.sh | bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The installer will:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Detect your platform and architecture&lt;/li&gt;
&lt;li&gt;Download the appropriate binary&lt;/li&gt;
&lt;li&gt;Install to a standard location&lt;/li&gt;
&lt;li&gt;Configure shell integration for bash/zsh/fish&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Manual Commands
&lt;/h2&gt;

&lt;p&gt;You can also use AutoNode manually:&lt;/p&gt;

&lt;h3&gt;
  
  
  Check detected version without switching
&lt;/h3&gt;



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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Force reinstall detected version
&lt;/h3&gt;



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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Update AutoNode itself
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  autonode update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Real-World Use Cases
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Development Teams
&lt;/h2&gt;

&lt;p&gt;Ensure all team members use consistent Node.js versions across projects without manual intervention.&lt;/p&gt;

&lt;h2&gt;
  
  
  CI/CD Pipelines
&lt;/h2&gt;

&lt;p&gt;Automatically use the correct Node version in build scripts without hardcoding version numbers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Monorepo Management
&lt;/h2&gt;

&lt;p&gt;Different packages in a monorepo can specify different Node requirements, and AutoNode handles transitions seamlessly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Docker Development
&lt;/h2&gt;

&lt;p&gt;Parse Node versions directly from Dockerfiles to match your local environment with production.&lt;/p&gt;

&lt;h2&gt;
  
  
  Compatibility
&lt;/h2&gt;

&lt;p&gt;Operating Systems:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;macOS (Intel &amp;amp; Apple Silicon)&lt;/li&gt;
&lt;li&gt;Linux (AMD64 &amp;amp; ARM64)&lt;/li&gt;
&lt;li&gt;Windows (AMD64)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Version Managers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;nvm (Node Version Manager)&lt;/li&gt;
&lt;li&gt;nvs (Node Version Switcher)&lt;/li&gt;
&lt;li&gt;Volta&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Shells:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;bash&lt;/li&gt;
&lt;li&gt;zsh&lt;/li&gt;
&lt;li&gt;fish&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Roadmap
&lt;/h1&gt;

&lt;p&gt;Planned improvements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Additional version manager support (fnm, asdf)&lt;/li&gt;
&lt;li&gt;Configuration file for custom behavior&lt;/li&gt;
&lt;li&gt;Shell completion scripts&lt;/li&gt;
&lt;li&gt;Package manager distribution (Homebrew, apt)&lt;/li&gt;
&lt;li&gt;Pre-commit hooks integration&lt;/li&gt;
&lt;li&gt;CI/CD action/workflow templates&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Contributing&lt;/p&gt;

&lt;p&gt;AutoNode is open source and welcomes contributions. Whether it's:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bug reports and fixes&lt;/li&gt;
&lt;li&gt;New version detector implementations&lt;/li&gt;
&lt;li&gt;Version manager integrations&lt;/li&gt;
&lt;li&gt;Documentation improvements&lt;/li&gt;
&lt;li&gt;Feature requests&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Check out the &lt;a href="https://github.com/matutetandil/autonode" rel="noopener noreferrer"&gt;https://github.com/matutetandil/autonode&lt;/a&gt; to get involved.&lt;/p&gt;

&lt;h1&gt;
  
  
  Try It Out
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Installation:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://raw.githubusercontent.com/matutetandil/autonode/main/install.sh | bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Quick test:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  &lt;span class="nb"&gt;mkdir &lt;/span&gt;test-project &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;test-project
  &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"18.17.0"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; .nvmrc
  &lt;span class="c"&gt;# AutoNode switches automatically&lt;/span&gt;
  node &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Feedback Wanted:
&lt;/h1&gt;

&lt;p&gt;I'm actively looking for feedback on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Does it work reliably with your setup?&lt;/li&gt;
&lt;li&gt;Any edge cases in version detection?&lt;/li&gt;
&lt;li&gt;Performance in large monorepos?&lt;/li&gt;
&lt;li&gt;Installation experience on different platforms?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Feel free to open an issue or start a discussion on GitHub!&lt;/p&gt;

&lt;p&gt;Resources&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GitHub Repository: &lt;a href="https://github.com/matutetandil/autonode" rel="noopener noreferrer"&gt;https://github.com/matutetandil/autonode&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Documentation: Full setup and usage guide in the README&lt;/li&gt;
&lt;li&gt;Installation Script: Direct download and shell integration&lt;/li&gt;
&lt;li&gt;Releases: Pre-built binaries for all platforms&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;AutoNode aims to simplify Node.js version management across projects. If you find it useful or have suggestions, I'd love to hear from you!&lt;/p&gt;




</description>
      <category>go</category>
      <category>node</category>
      <category>cli</category>
      <category>devtools</category>
    </item>
  </channel>
</rss>
