Error: Cannot find module 'node:path' when running Sanity dev
The error you're encountering (Cannot find module 'node:path') is a classic Node.js version compatibility issue. The node: protocol prefix for built-in modules requires a modern Node.js version, and based on your error, you're likely running an outdated version.
The Solution: Upgrade to Node.js 20 or higher
According to the Sanity Studio v4 requirements, you need Node.js version 20 or higher. When you ran npm create sanity@latest, you installed the latest Sanity Studio (v4), which requires this newer Node version.
Here's how to fix it:
Check your current Node.js version:
node -vInstall Node.js 20 or higher:
- Download from nodejs.org
- Or use a version manager like nvm (recommended for managing multiple Node versions)
If using nvm on Windows (nvm-windows):
nvm install 20 nvm use 20Verify the installation:
node -v # Should show v20.x.x or higherDelete node_modules and reinstall:
cd C:/Users/Johannes/Desktop/Websites/pizSanity rmdir /s node_modules del package-lock.json npm installStart the dev server:
npm run dev
The reason this requirement exists is that Node.js 18 reached end-of-life in April 2024, and Sanity Studio v4 needs the improvements from modern tooling like Vite 7, which requires Node 20+.
If you absolutely need to use an older Node version for other projects, consider using nvm to switch between Node versions per project. This way you can have different Node versions for different projects without conflicts.
Show original thread3 replies
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.