Does anyone get this error? I have had this problem for a while now and I’m not sure how to resolve it: ``` ╰─ sudo npm install -g @sanity/cli Password: /usr/local/bin/sanity...
I've seen this issue before! You're running @sanity/cli@2.1.4, which is Sanity v2 - a significantly older version. The error during sanity install suggests dependency resolution problems, which can happen with older Sanity versions when combined with modern Node.js/npm versions or environment conflicts.
Immediate troubleshooting steps:
Check your Node.js version:
node -vThe version compatibility is crucial here. Sanity v2 was built for older Node.js versions, while Sanity Studio v4 requires Node.js 20+. If you're on a very recent Node version, this could cause dependency resolution failures with v2 packages that weren't designed for it.
Address the Anaconda environment: I notice
(anaconda3)in your terminal prompt. Conda environments can interfere with npm's dependency resolution because they modify PATH and can introduce conflicting binaries:conda deactivate sanity installClear caches and lockfiles:
rm -rf node_modules rm package-lock.json rm yarn.lock # if it exists npm cache clean --force sanity installUpdate npm: Your output shows npm 6.14.8 with an available update to 6.14.11. While this might not be the root cause, updating could help:
npm install -g npmCheck your package.json: Look at the dependencies in your
package.jsonfile. Sometimes v2 projects have dependency version conflicts that need manual resolution.
The bigger picture - consider upgrading:
Since you're on v2 (from 2020-2021 era), you're likely hitting compatibility issues because the npm ecosystem has evolved significantly. Old dependency trees can fail to resolve with modern package managers and Node versions.
I'd strongly recommend upgrading to Sanity Studio v4. While it requires Node.js 20+, you'll get:
- Modern dependency resolution that works with current tooling
- Active support and security updates
- Better performance and developer experience
- Access to features like Live Content API, Functions, and Content Releases
If you need to stay on v2 temporarily:
Try checking if there's a specific package causing the failure by looking at your package.json dependencies. You might also try using an older Node.js version via nvm to match what v2 was originally built against - typically Node 12-16 era.
What Node.js version are you running? That info would help narrow down the issue further. Also, the Anaconda environment is my top suspect here - try deactivating it first before other troubleshooting.
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.