CLI Error: "unable to verify the first certificate" when creating project
Im creating a new project through the CLI and I'm having the following error:
Error: unable to verify the first certificate
at TLSSocket.onConnectSecure (node:_tls_wrap:1568:34)
at TLSSocket.emit (node:events:511:28)
at TLSSocket._finishInit (node:_tls_wrap:985:8)
at ssl.onhandshakedone (node:_tls_wrap:771:12)β― npm -y create sanity@latest
You're setting up a new project!
We'll make sure you have an account with <http://Sanity.io|Sanity.io>. Then we'll
install an open-source JS content editor that connects to
the real-time hosted API on <http://Sanity.io|Sanity.io>. Hang on.
Press ctrl + C at any time to quit.
Prefer web interfaces to terminals?
You can also set up best practice Sanity projects with
your favorite frontends on <https://www.sanity.io/templates>
Looks like you already have a Sanity-account. Sweet!
β Fetching existing projects
? Select project to use Create new project
? Your project name: ######
? Select organization to attach project to Mezcal Trascendente [######]
Your content will be stored in a dataset that can be public or private, depending on
whether you want to query your content with or without authentication.
The default dataset configuration has a public dataset named "production".
? Use the default dataset configuration? Yes
β Creating dataset
? Project output path: /######
? Select project template Clean project with no predefined schemas
? Do you want to use TypeScript? Yes
β Bootstrapping files from template
β Resolving latest module versionsThis is a common Node.js/npm TLS certificate error that typically occurs when your Node environment can't verify SSL certificates. It's not specific to Sanity, but happens during the CLI installation when npm tries to fetch packages securely. Here are the most common solutions:
Quick fixes to try:
Check your Node.js version - Make sure you're using a current version of Node.js (20+ is required for Sanity Studio v4). Older versions may have outdated certificate chains:
node --versionDisable strict SSL temporarily (not recommended for production, but useful for troubleshooting):
npm config set strict-ssl false npm -y create sanity@latest # Then re-enable it after: npm config set strict-ssl trueUpdate your npm CA certificates:
npm config set cafile "" npm cache clean --forceCheck if you're behind a corporate proxy/firewall - If you're on a corporate network, you may need to configure npm to use your company's proxy or certificate:
npm config set proxy http://your-proxy:port npm config set https-proxy http://your-proxy:portTry using a different registry temporarily:
npm config set registry https://registry.npmjs.org/
Most likely causes:
- Corporate firewall/proxy intercepting SSL connections
- Antivirus software interfering with SSL
- Outdated Node.js installation with old root certificates
- VPN or network security software
Since the error happens during "Resolving latest module versions," it's occurring when npm tries to fetch Sanity packages from the registry. Try the strict-ssl workaround first to confirm it's a certificate issue, then work on the proper solution based on your network environment.
If you're on a corporate network, you'll likely need to get the proper CA certificate from your IT team and configure npm to use it.
Show original thread11 replies
Was this answer helpful?
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.