Troubleshooting errors with Sanity on M1 MBP and Node version

6 replies
Last updated: Dec 29, 2021
has anyone else used Sanity on an M1 MBP yet? I'm hitting some errors and trying to figure out if it's related to the M1 or something else
sanity start
✔ Checking configuration files...
⠸ Compiling...webpack built d70252c1ea55521fce28 in 5521ms
✔ Compiling...
Failed to compile.

Error in ./dashboardConfig.js (part:@sanity/dashboard/config)
Module build failed: Error: error:0308010C:digital envelope routines::unsupported
    at Generator.next (<anonymous>)
    at new Promise (<anonymous>)
 @ ./node_modules/@sanity/dashboard/lib/legacyParts.js 45:37-78
 @ ./node_modules/@sanity/dashboard/lib/containers/Dashboard.js
 @ ./node_modules/@sanity/dashboard/lib/DashboardTool.js
 @ ./node_modules/@sanity/dashboard/lib/DashboardTool.js (all:part:@sanity/base/tool)
 @ ./node_modules/@sanity/default-layout/lib/router.js
 @ ./node_modules/@sanity/default-layout/lib/Root.js (part:@sanity/base/root)
 @ ./node_modules/@sanity/base/lib/components/SanityRoot.js (part:@sanity/base/sanity-root)
 @ ./node_modules/@sanity/server/lib/browser/entry-dev.js
 @ multi ./node_modules/@sanity/server/lib/browser/entry-dev.js

Error in ./schemas/schema.js (part:@sanity/base/schema)
Module build failed: Error: error:0308010C:digital envelope routines::unsupported
    at Generator.next (<anonymous>)
    at new Promise (<anonymous>)
 @ ./node_modules/@sanity/default-layout/lib/util/getNewDocumentModalActions.js 8:37-72
 @ ./node_modules/@sanity/default-layout/lib/constants.js
 @ ./node_modules/@sanity/default-layout/lib/defaultLayout/DefaultLayout.js
 @ ./node_modules/@sanity/default-layout/lib/defaultLayout/index.js
 @ ./node_modules/@sanity/default-layout/lib/Root.js (part:@sanity/base/root)
 @ ./node_modules/@sanity/base/lib/components/SanityRoot.js (part:@sanity/base/sanity-root)
 @ ./node_modules/@sanity/server/lib/browser/entry-dev.js
 @ multi ./node_modules/@sanity/server/lib/browser/entry-dev.js

Error in ./components/logo.js (part:@sanity/base/brand-logo)
Module build failed: Error: error:0308010C:digital envelope routines::unsupported
    at Generator.next (<anonymous>)
    at new Promise (<anonymous>)
 @ ./node_modules/@sanity/default-login/lib/legacyParts.js 43:40-80
 @ ./node_modules/@sanity/default-login/lib/LoginWrapper.js (part:@sanity/base/login-wrapper)
 @ ./node_modules/@sanity/default-layout/lib/Root.js (part:@sanity/base/root)
 @ ./node_modules/@sanity/base/lib/components/SanityRoot.js (part:@sanity/base/sanity-root)
 @ ./node_modules/@sanity/server/lib/browser/entry-dev.js
 @ multi ./node_modules/@sanity/server/lib/browser/entry-dev.js
AI Update

Good news - this isn't actually an M1-specific issue! The error:0308010C:digital envelope routines::unsupported error is caused by Node.js 17's upgrade to OpenSSL 3, which broke compatibility with the version of webpack that Sanity Studio v2 uses.

Based on the GitHub issue discussion, here are your options:

Quick Fixes

Option 1: Downgrade to Node.js 16 (Recommended for Studio v2)

# If using nvm
nvm install 16
nvm use 16

This is the cleanest solution and what most people in that thread confirmed works perfectly.

Option 2: Use the OpenSSL legacy provider

export NODE_OPTIONS=--openssl-legacy-provider
sanity start

This tells Node.js 17+ to use the legacy OpenSSL provider, working around the compatibility issue.

Long-term Solution

Upgrade to Sanity Studio v3 or v4: The newer versions switched to Vite instead of webpack, which completely resolves this issue. Note that Studio v4 requires Node.js 20 or higher.

Why This Happens

Node.js 17 introduced OpenSSL 3 which removed support for certain cryptographic algorithms that older versions of webpack relied on. This affects many projects using webpack 4, not just Sanity. Your M1 Mac is working fine - it's purely a Node.js version compatibility issue that would happen on any machine with Node 17+.

I’m using Sanity Studio on an M1 MBP with no issues so I imagine the problem is unrelated
Thanks for confirming the Studio's running for you on an M1,
user Q
🙂

user N
, what version of Node are you using? If it's v17 for example, you may want to try reverting to v16 (LTS) to see if that helps resolve the errors.
Same here, node 16 on M1 no issues, I also found this SO question with the same error message: https://stackoverflow.com/questions/69692842
another thought - how did you install Node.js, e.g. through Homebrew, NVM, direct download? and are you using the arm64 version, or x86 through Rosetta?
running v17.2, used Homebrew to install NVM and NVM to install node. The error went away after I did a
sanity upgrade
though. For some reason
@sanity/core
was at a lower version number than on my old machine 🤷
switching to node 16 did solve a similar issue running Gatsby for me

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.

Was this answer helpful?