Error encountered while testing sanity, resolved by deleting node_modules folder.
Based on the error you're seeing, the main issue is that you're using Node.js v18.17.0, but Sanity Studio v4 requires Node.js version 20 or higher. The error with esbuild failing to install is a symptom of this version incompatibility.
Here's how to fix this:
1. Upgrade to Node.js 20 or higher
You need to upgrade your Node.js installation. The easiest way to do this on Windows is:
- Download directly from nodejs.org - Get the LTS (Long Term Support) version, which is currently v20 or higher
- Or use a version manager like nvm-windows to easily switch between Node versions
After installing, verify your version with:
node -vYou should see v20.x.x or higher.
2. Clear your npm cache
Since you're seeing those EPERM errors related to the npm cache, it's a good idea to clear it after upgrading:
npm cache clean --force3. Try the installation again
Now run the Sanity creation command again:
npm create sanity@latestWhy this happened
As explained in Sanity's blog post about the v4 requirements, Sanity Studio v4 requires Node.js 20+ because Node.js 18 reached end-of-life in April 2024. This change allows Sanity to use modern tooling improvements like Vite 7, which provides faster builds and better performance.
The EPERM (operation not permitted) errors you're seeing with the npm cache and the esbuild installation failure are both consequences of trying to run packages that expect Node.js 20+ features on your current Node.js 18 installation.
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.