Перейти к содержимому
Блог

Sanity: '@sanity/cli-core/ux' does not provide an export 'chalk'

Fresh Sanity Studio crashing on npm run dev with "does not provide an export named 'chalk'"? Why it happens, the reported version pin fix, and how to check.

The Liite team6 мин чтения

Short answer

The crash means two Sanity packages in your project are at mismatched versions. The fix reported in the Sanity GitHub issue is to set sanity and @sanity/vision to ^5.8.2-next.3, delete node_modules and the lockfile, and reinstall. Check first whether a newer stable release already fixes it, because the issue dates from early February 2026.

You ran npm create sanity@latest, installed the project, started it with npm run dev, and the Studio crashed before it opened. The terminal shows this:

The requested module '@sanity/cli-core/ux' does not provide an export named 'chalk'

You haven't edited anything yet, so it's confusing. This page explains the likely cause, the fix, and how to tell whether you still need it.

Why it happens

The message comes from Node's ES module loader. Some code did import { chalk } from '@sanity/cli-core/ux', and the copy of that module in your project has no export named chalk. MDN explains that a module can have several named exports, and an import of a name the module doesn't export fails when the module is evaluated. See MDN's reference for export.

In practice this points to packages that expect each other but were installed at versions that don't match. A new project is exposed to this because it has no lockfile, so the package manager picks the newest versions that satisfy the ranges at that moment. If one package in the set was published a little before or after its partner, you get a mix that doesn't line up. Nothing in your own code caused it.

We can't say exactly which releases were affected or whether the mismatch is fixed now. The only evidence is a Sanity GitHub issue (number 12100, filed 2026-02-05). It describes a workaround, not a root-cause write-up from Sanity. Treat the pin below as temporary.

Quick reference

CauseSymptomFix
Mismatched Sanity packages from a fresh installStudio crashes on npm run dev with the chalk export errorPin sanity and @sanity/vision, reinstall
Old lockfile keeps the broken resolutionPin edited but same errorDelete lockfile and node_modules, reinstall
Only one of the two packages pinnedError returns or changes slightlyPin both to the same version
Different error after the pinNew message, not the chalk oneSearch that message separately

How to fix it

Work through these in order.

Fix 1: Check whether a newer release fixes it

  1. Open the Sanity GitHub issue (search GitHub for "sanity-io/sanity issue 12100") and read the latest comments.
  2. If a maintainer names a fixed stable version, install that instead of the pre-release.
  3. Run npm view sanity version to see the current stable release.

If the current stable version is newer than what your project installed, try updating first. If that works, you don't need the pin.

Fix 2: Pin the two packages

  1. Open your project's package.json.
  2. Set both dependencies to the versions from the issue:
"sanity": "^5.8.2-next.3",
"@sanity/vision": "^5.8.2-next.3"
  1. Delete the node_modules folder.
  2. Delete your lockfile: package-lock.json, yarn.lock or pnpm-lock.yaml.
  3. Run npm install, or the equivalent for your package manager.
  4. Start the Studio again with npm run dev.

What `next` means

The next in the version string marks a pre-release build. It's fine for getting unblocked on a new project, but move to a normal stable version once Sanity publishes one that includes the fix, then change the ranges back.

Fix 3: Try a targeted install if you want to keep the lockfile

If you'd rather not delete the lockfile, try this first:

npm install sanity@^5.8.2-next.3 @sanity/vision@^5.8.2-next.3

If the same error still appears, fall back to deleting the lockfile and node_modules as in Fix 2.

What won't help

  • Reinstalling without changing versions. If package.json still allows the same combination, the package manager resolves it the same way.
  • Editing files inside node_modules. The change disappears on the next install and hides the real mismatch.
  • Installing chalk yourself. The error is about an export of @sanity/cli-core/ux, not a missing chalk dependency in your project. Adding chalk doesn't create that export.
  • Switching Node versions first. The report describes an export mismatch, not a Node incompatibility. Look at your Node version only if the pin fails and Sanity's documented requirements list a different range.

Don't leave a pre-release pinned forever

Pre-release builds can change between versions. If you commit the pin, add a note to revisit it, or you may stay on a next build long after a stable fix ships.

Checklist before you try again

  • You ran npm ls sanity and noted which version your project actually resolved.
  • Both sanity and @sanity/vision are set to the same version range.
  • The old node_modules folder is gone.
  • The old lockfile is gone, or you tried the targeted install first.
  • You reinstalled with the same package manager you'll use to run the project.
  • You read the latest comments on the GitHub issue for a named fixed version.

How to check whether it's still a problem

This is a version-specific bug in a fast-moving toolchain, so it may not affect you by the time you read this. Run npm ls sanity to see what your project resolved, and npm view sanity version to see the current stable release. If the pin fixes the crash but you then hit a different error, search for that new message on its own. It is probably a separate problem.

If nothing works

Ask in the Sanity GitHub issue or open a new one with your details, or use Sanity's support channels. Include the exact error text, the output of npm ls sanity, your Node version (node -v), your package manager and its version, and the steps you already tried.

Fresh project from `npm create sanity@latest` fails on `npm run dev` with:
The requested module '@sanity/cli-core/ux' does not provide an export named 'chalk'

Node: <output of node -v>
Package manager: <npm/yarn/pnpm and version>
Resolved versions: <output of npm ls sanity>
Tried: pinning sanity and @sanity/vision to ^5.8.2-next.3, deleting node_modules and the lockfile, reinstalling.
Result: <same error / new error text>

Common questions

Do I need to pin both packages?

Yes. The report names both sanity and @sanity/vision. Leaving one on the old range can bring the mismatch back.

Is this a problem with my project template?

Nothing in the report suggests so. The error appeared on a fresh project created with npm create sanity@latest, before any custom code was added.

Is it safe to stay on the next version?

It works as a stopgap, but pre-release builds can change from one version to the next. Move to the stable release that includes the fix once Sanity publishes it.

Will installing chalk directly fix it?

No. The failing import is from @sanity/cli-core/ux, and that module is what lacks the export.