πŸ‘‹ Next.js Conf 2024: Come build, party, run, and connect with us! See all events

Error caused by multiple versions of @sanity/ui installed

17 replies
Last updated: Jan 28, 2021
I just updated the studio to
^2.2.3
and I have this error as soon I open a document πŸ‘€
Jan 26, 2021, 6:19 PM
Component stack below:
Jan 26, 2021, 6:20 PM
Same here
Jan 26, 2021, 6:20 PM
I too updated locally to
^2.2.3
and got this message
The above error occurred in the <Card> component:
    in Card (created by DocumentPanel)
    in DocumentPanel (created by DocumentPane)
    in div (created by DocumentPane)
    in div (created by ForwardRef(ScrollContainer))
    in ForwardRef(ScrollContainer) (created by EnabledChangeConnectorRoot)
    in Tracker (created by EnabledChangeConnectorRoot)
    in EnabledChangeConnectorRoot (created by DocumentPane)
    in div (created by KeyboardShortcutResponder)
    in KeyboardShortcutResponder (created by GetHookCollectionState)
    in GetHookCollectionState (created by RenderActionCollectionState)
    in RenderActionCollectionState (created by DocumentActionShortcuts)
    in DocumentActionShortcuts (created by DocumentPane)
    in DocumentPane (created by DocumentPaneProvider)
    in DocumentHistoryProvider (created by DocumentPaneProvider)
    in DocumentPaneProvider
    in StreamingComponent
    in StreamingComponent (created by Context.Consumer)
    in WithInitialValueWrapper (created by DeskToolPane)
    in DeskToolPane (created by DeskToolPanes)
    in SplitPaneWrapper (created by DeskToolPanes)
    in div (created by Pane)
    in Pane (created by SplitPane)
    in div (created by SplitPane)
    in SplitPane (created by PanesSplitController)
    in div (created by PanesSplitController)
    in div (created by Pane)
    in Pane (created by SplitPane)
    in div (created by SplitPane)
    in SplitPane (created by PanesSplitController)
    in div (created by PanesSplitController)
    in PanesSplitController (created by DeskToolPanes)
    in div (created by DeskToolPanes)
    in DeskToolPanes (created by DeskTool)
    in DeskTool (created by withRouter(DeskTool))
    in withRouter(DeskTool) (created by DeskToolPaneStateSyncer)
    in DeskToolPaneStateSyncer (created by DeskTool)
    in DeskToolFeaturesProvider (created by DeskTool)
    in DeskTool (created by RenderTool)
    in RenderTool (created by SchemaErrorReporter)
    in RouteScope (created by SchemaErrorReporter)
    in div (created by SchemaErrorReporter)
    in div (created by SchemaErrorReporter)
    in div (created by SchemaErrorReporter)
    in SchemaErrorReporter (created by DefaultLayout)
    in DefaultLayout (created by withRouter(DefaultLayout))
    in withRouter(DefaultLayout) (created by DefaultLayoutRoot)
    in RouterProvider (created by DefaultLayoutRoot)
    in LoginWrapper (created by DefaultLayoutRoot)
    in DefaultLayoutRoot (created by AppProvider)
    in div (created by styled.div)
    in styled.div (created by Box)
    in Box (created by Styled(Box))
    in Styled(Box) (created by Card)
    in Ge (created by ThemeProvider)
    in ThemeProvider (created by ThemeColorProvider)
    in ThemeColorProvider (created by Card)
    in Card (created by Styled(Card))
    in Styled(Card) (created by AppProvider)
    in SnackbarProvider (created by AppProvider)
    in LayerProvider (created by AppProvider)
    in PortalProvider (created by AppProvider)
    in UserColorManagerProvider (created by AppProvider)
    in AppProvider (created by SanityRoot)
    in Ge (created by ThemeProvider)
    in ThemeProvider (created by SanityRoot)
    in SanityRoot
    in AppContainer

React will try to recreate this component tree from scratch using the error boundary you provided, RenderTool. react_devtools_backend.js:2430:23
Jan 26, 2021, 10:55 PM
Thanks all, we're investigating this at the moment.
Jan 27, 2021, 9:19 AM
This is caused by having multiple versions of
@sanity/ui
installed. You can work around it by making sure to install the same version of
@sanity/ui
as the one
@sanity/base
installs πŸ™‚ We're working on a better solution for this πŸ˜„
Jan 27, 2021, 9:44 AM
npm install @sanity/ui@0.32.8
Jan 27, 2021, 9:46 AM
Awesome. Thanks for the quick work πŸ‘
Jan 27, 2021, 1:52 PM
I tried this, still getting the same issue πŸ€” i also tried deleting my node_modules and yarn.lock without any success
Jan 27, 2021, 9:43 PM
Yeah, it created a different issue for me (reported in different thread in sanity-ui)
Jan 27, 2021, 9:44 PM
πŸ˜’ I tried to revert all my changes and now i cant even access my studio anymore...
Jan 27, 2021, 10:02 PM
second problem was fixed after i deleted my node_modules &gt;.&gt;
Jan 27, 2021, 10:07 PM
user S
that
gray
error was the same one I hit after
yarn add @sanity/ui@0.32.8
. You’re saying deleting your node modules resolved the issue? Then did you run
yarn add
to add everything back?
Jan 27, 2021, 10:09 PM
so i reverted all my changes to package to the version before updating sanity, then yes delete the node modules, aswell as package.lock or yarn.lock
Jan 27, 2021, 10:10 PM
oh gotcha, so you were unable to get their fix to work?
Jan 27, 2021, 10:11 PM
Luckily I’m ok with my broken updated branch and can work on something else while waiting for a fix 😁
Jan 27, 2021, 10:11 PM
It if helps, the new version of the sanity-plugin-media was also responsible for the crash. After reverting both sanity and the media plugin, I’m back to business πŸ˜…
Jan 27, 2021, 10:26 PM
For those of you still struggling after installing an older version of
@sanity/ui
manually. I'm thinking maybe there is some other package depending on
@sanity/ui
which could have a different version. Or maybe "something" is overriding you so when you install you still effectively end up with different versions.
1. Try removing
node_modules
that should be a good bet in most cases2. If problem persist search your
node_modules
directory to see which versions of
@sanity/ui
reside in it. I've written a
find
-command you can use:
$ find node_modules -type d -iname 'ui*' -exec grep --with-filename 'version": ' {}/package.json \;
This will find all
@sanity/ui
directories and print the
version
from
package.json
. For instance in this studio where I've installed different versions on purpose:

❯ find node_modules -type d -iname 'ui*' -exec grep --with-filename 'version": ' {}/package.json \;
node_modules/@sanity/ui/package.json:  "version": "0.33.0"
node_modules/@sanity/desk-tool/node_modules/@sanity/ui/package.json:  "version": "0.32.9"
node_modules/@sanity/form-builder/node_modules/@sanity/ui/package.json:  "version": "0.32.9"
node_modules/@sanity/base/node_modules/@sanity/ui/package.json:  "version": "0.32.9"
(Notice top is different from all the others)

This should let you identify if other plugins (etc.) install a different version.
Jan 28, 2021, 7:43 AM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?