Upgrading to Sanity v3 causes "No matching export" error in RxJS

13 replies
Last updated: Mar 15, 2023
Hi folks! I'm currently upgrading from v2 to v3 and when I run "sanity dev" or "npm run dev" i get this message:

node_modules/@sanity/portable-text-editor/lib/index.esm.js:5:16: ERROR: No matching export in "node_modules/rxjs/_esm5/index.js" for import "tap"

As several people already suggested, I've tried deleting my `node_modules`folder and installing again, but it doesn't work.

Anyone else got a solution for this?
AI Update

This is a known issue that occurred during the v2 to v3 migration, and it's specifically related to the @sanity/document-internationalization plugin having incompatible RxJS peer dependencies. Here's what's happening and how to fix it:

The Root Cause

The error you're seeing is because @sanity/document-internationalization version 1.0.5 requires RxJS v6, but Sanity v3 uses RxJS v7. This creates a peer dependency conflict that npm can't resolve automatically.

Solutions (in order of preference)

1. Update the document-internationalization plugin (Best solution)

The plugin has been updated to support RxJS v7. According to the community discussion, updating to @sanity/document-internationalization@^1.1.0 or later should resolve this. Make sure you're on the latest version:

npm install @sanity/document-internationalization@latest

2. Use the --legacy-peer-deps flag

As confirmed in this thread, installing with the legacy peer deps flag works as a workaround:

npm install --legacy-peer-deps

You can also add this to your .npmrc file to make it permanent:

legacy-peer-deps=true

3. Clean install process

Sometimes the issue resolves with a complete clean install:

rm -rf node_modules package-lock.json
npm install --legacy-peer-deps

4. Temporary workaround (if nothing else works)

Add RxJS 7.8.0 as a dev dependency to force the correct version:

npm install rxjs@^7.8.0 --save-dev --legacy-peer-deps

Why This Happens

This is a transitional issue that affected early v3 adopters. The @sanity/document-internationalization plugin initially had a peer dependency on RxJS v6, while Sanity v3 moved to RxJS v7. The plugin has since been updated, but if you're using an older version or have a locked package-lock.json, you'll hit this conflict.

The good news is that several people in the community reported that after trying these solutions (particularly the clean install or updating the plugin), "it suddenly started working" - so don't give up if the first attempt doesn't work!

Did you also delete your package lock before reinstalling?
+1 , still having this issue, delated the package lock and node_modules, with no luck
when running
sanity dev 

Let me replicate this and see if I can work out a fix. What was the version you were previously on?
3.2.6

Can you give this solution a try in the mean time?
ok, yes, adding rexjs@7.8.0 as a dev dependence gets the studio to work again.
Not ideal but adding that deleting
package-lock.json
did the trick for me.
Thanks for the replys. I don't know what triggered it for me, but when I returned to the project to try these solutions it just worked out of the box. Don't know if a restart of the terminal (read: closing VS Code and reopening days later) did the trick, or if it was any of the things I previously tried (deleting node_modules, package-lock etc.) šŸ¤”
Anyways, thanks
šŸ˜‰
Has there been any development with fixing this issue? I can’t get studio to run even after deleting node_modules and package-lock
It seems to be at least somehow related to the
@sanity/document-internationalization
plugin for me, if I remove that, all appears to be working
unfortunately I need it šŸ˜›
and suddenly it’s working… šŸ¤·ā€ā™‚ļø

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?