Error installing Sanity via npm on terminal
Welcome to Sanity! đź‘‹ Happy to help you get started. Without knowing the specific error you're encountering, let me cover the most common installation issues and the proper way to install Sanity in 2025.
The Modern Way to Install Sanity
The recommended approach is now to use npm create sanity@latest rather than installing the CLI globally:
npm create sanity@latestThis command will guide you through an interactive setup process to create a new Sanity project, including authentication, project creation, dataset configuration, and template selection.
Common Installation Issues & Solutions
1. Node.js Version Requirements
The most common issue is using an outdated Node.js version. Sanity Studio v4 requires Node.js 20 or higher. Check your version:
node -vIf you're on an older version, download and install Node.js 20+ from nodejs.org.
2. Permission Errors (EACCES)
If you see permission errors when installing globally, avoid using sudo. Instead, configure npm to use a different directory or use a Node version manager like nvm.
3. Network/Registry Issues
If npm is timing out or having trouble connecting, try:
npm config set registry https://registry.npmjs.org/4. Cache Issues
Sometimes clearing the npm cache helps:
npm cache clean --forceAlternative Installation Methods
If npm create sanity@latest doesn't work, you can also try:
Using npx (no installation needed):
npx -y sanity@latest initOr install the CLI globally first:
npm install --global sanity@latest
sanity initAs detailed in the Sanity CLI documentation, the sanity init command provides options for unattended mode (-y), specifying project and dataset names, choosing templates, and more.
Next Steps
Once installation succeeds, you can start your development server with:
npm run devCould you share the specific error message you're seeing? That would help pinpoint the exact issue. Common error messages include things like "EACCES", "command not found", "unsupported engine", or network timeouts. With the actual error, I or others in the community can provide more targeted help!
Show original thread10 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.