<?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: Nzoputachi Emmanuel</title>
    <description>The latest articles on Forem by Nzoputachi Emmanuel (@enzoputachi).</description>
    <link>https://forem.com/enzoputachi</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%2F2530201%2F3839d5a8-05b4-4346-a66e-35b52ff4f186.jpg</url>
      <title>Forem: Nzoputachi Emmanuel</title>
      <link>https://forem.com/enzoputachi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/enzoputachi"/>
    <language>en</language>
    <item>
      <title>How to Fix Sanity Studio Module Error on Windows</title>
      <dc:creator>Nzoputachi Emmanuel</dc:creator>
      <pubDate>Thu, 04 Dec 2025 08:20:48 +0000</pubDate>
      <link>https://forem.com/enzoputachi/fixing-sanity-studio-unable-to-resolve-sanity-module-root-error-on-windows-36gk</link>
      <guid>https://forem.com/enzoputachi/fixing-sanity-studio-unable-to-resolve-sanity-module-root-error-on-windows-36gk</guid>
      <description>&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;When starting Sanity Studio v4.20.0 on Windows, the development server shows this error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Error: Unable to resolve `sanity` module root
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This happens even after clean install with all dependencies installed properly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why This Happens
&lt;/h2&gt;

&lt;p&gt;Sanity version 4.20.0 has circular dependency problem that affects specifically Windows. This is because Windows handles the module paths different from Unix systems. The issue is documented in Sanity GitHub and only Windows users are affected.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Fix
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: Downgrade Version
&lt;/h3&gt;

&lt;p&gt;Most reliable solution is downgrading to Sanity v4.18.0 which does not have this problem.&lt;/p&gt;

&lt;p&gt;Change the &lt;code&gt;package.json&lt;/code&gt; like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"dependencies"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"sanity"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"4.18.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"@sanity/vision"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"4.18.0"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Important:&lt;/strong&gt; Remove the caret (&lt;code&gt;^&lt;/code&gt;) symbol to pin exact version and prevent automatic updates.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Clean Install
&lt;/h3&gt;

&lt;p&gt;Remove existing dependencies and lock files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# PowerShell or Command Prompt&lt;/span&gt;
&lt;span class="nb"&gt;rmdir&lt;/span&gt; /s /q node_modules
del package-lock.json

&lt;span class="c"&gt;# Git Bash&lt;/span&gt;
&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; node_modules package-lock.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then reinstall dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install
&lt;/span&gt;npm run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>npm</category>
      <category>help</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
