<?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: Vraj Patel</title>
    <description>The latest articles on Forem by Vraj Patel (@vraj_patel_5fa2d0b45f18cb).</description>
    <link>https://forem.com/vraj_patel_5fa2d0b45f18cb</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%2F3594689%2F4fc8fa72-3195-4dc3-bb15-1311be045799.jpg</url>
      <title>Forem: Vraj Patel</title>
      <link>https://forem.com/vraj_patel_5fa2d0b45f18cb</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/vraj_patel_5fa2d0b45f18cb"/>
    <language>en</language>
    <item>
      <title>if npm hallucinates versions, check your root</title>
      <dc:creator>Vraj Patel</dc:creator>
      <pubDate>Mon, 03 Nov 2025 21:10:12 +0000</pubDate>
      <link>https://forem.com/vraj_patel_5fa2d0b45f18cb/if-npm-hallucinates-versions-check-your-root-3dp0</link>
      <guid>https://forem.com/vraj_patel_5fa2d0b45f18cb/if-npm-hallucinates-versions-check-your-root-3dp0</guid>
      <description>&lt;p&gt;So about a year ago, I started getting this strange npm issue, where the terminal was detecting v17.9.1, eventhough I was using a later version. This started causing &lt;code&gt;npm i&lt;/code&gt;, &lt;code&gt;npm run dev&lt;/code&gt;, etc to stop working as I would be prompted to upgrade my node version.&lt;/p&gt;

&lt;p&gt;I asked alot of my buddies, scoured stackoverflow and reddit, asked gpt and claude, but it seemed the issue was kind of unheard of to an extent. I went as far as ground up reinstalling npm, nvm, and node. Still, no luck. Nvm didnt even see any v17 installed. I kind of left it at that.&lt;/p&gt;

&lt;p&gt;Well a week ago I wanted to make a new project, and the issue came up again. This time I had my Guji, Ethiopian light roast from DAK roasters, brewed using a v60, and that was enough to give me the motivation to solve it. So I started digging myself and looked through documentation like a nerd. &lt;/p&gt;

&lt;p&gt;The premise of the issue was something like this (this is a recent example)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ nvm use
Now using node v22.12.0 (npm v10.9.0)
$ npm run dev

&amp;gt; dev
&amp;gt; react-router dev

️⚠️ Oops, Node v17.9.1 detected. react-router requires a Node version greater than 20.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The gist of it is:&lt;/p&gt;

&lt;p&gt;When you run something like npm run dev, npm modifies the PATH by prepending node_modules/.bin directories&lt;/p&gt;

&lt;p&gt;The search order goes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/Users/*/node_modules/.bin/ 
/Users/*/Documents/node_modules/.bin/
/Users/*/Documents/GitHub/node_modules/.bin/
[...your project's node_modules...]
[...then your normal PATH with nvm...]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The issue with me, is a rouge npm package called "node" (v17.9.1) randomly ended up in the home directory: &lt;br&gt;
&lt;code&gt;/Users/*/node_modules/node/bin&lt;/code&gt;. So when npm executes node, it would pick up the version through that first.&lt;/p&gt;

&lt;p&gt;So why did &lt;code&gt;npm --version&lt;/code&gt; not pick this up? That's because no npm PATH manipulation had occurred yet, and the shell used the normal PATH where nvm's Node comes first. And saw v22.12.0 as expected.&lt;/p&gt;

&lt;p&gt;The fix: Just delete the random node module and it should be good to go. I don't even know how it ended up there if I'm completely honest, maybe I was tired after a long day of capstone grinding.&lt;/p&gt;

&lt;p&gt;TLDR: don't be dumb like me and accidentally install node into your home directory and forget about it...there will be reprecusions. If you do, just fix it lol.&lt;/p&gt;

</description>
      <category>npm</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
