Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

Compilation errors after upgrading Sanity due to missing react-icons

6 replies
Last updated: Feb 17, 2021
I just upgraded Sanity, and I get compilation errors for all the react icons, e.g. :
Error: Can't resolve 'react-icons/lib/io/android-color-palette'.
Can these not be used anymore?
Feb 17, 2021, 9:20 AM
Hi User, you might have upgraded from a version before
2.0.1
in this case, where we removed our own use (and therefore the dependency) of
react-icons
in the studio.
If you scroll down to the
Breaking changes header on this page, you should find instructions on how to fix the issue either by adding v2 of
react-icons
as a dependency or by upgrading to v3 and updating the import statements: https://github.com/sanity-io/sanity/releases/tag/v2.0.1
Feb 17, 2021, 9:24 AM
Yes, I did upgrade from a version before 2.0.1. I will take a look at the link. Thank you for the fast reply! šŸ‘šŸ˜€
Feb 17, 2021, 9:27 AM
I updatd icons to v3, then ran
npm install --global @sanity/cli
then ran

sanity codemod reactIconsv3
but I get:

@sanity/core not installed in current project
`Project-specific commands not available until you run `sanity install``
Do I still need to do some updates?
Feb 17, 2021, 9:43 AM
You may have to run
sanity install
before running the codemod, but that should be all šŸ™‚
Feb 17, 2021, 9:49 AM
Hehe, my brain though I had already run the sanity install....now I ran it for real.... almost there... Now when running the
codemode
command I get

events.js:167

throw er; // Unhandled 'error' event

^


Error: spawn npx ENOENT

at Process.ChildProcess._handle.onexit (internal/child_process.js:232:19)

at onErrorNT (internal/child_process.js:407:16)

at process._tickCallback (internal/process/next_tick.js:63:19)

Emitted 'error' event at:

at Process.ChildProcess._handle.onexit (internal/child_process.js:238:12)

at onErrorNT (internal/child_process.js:407:16)

at process._tickCallback (internal/process/next_tick.js:63:19)

I do not have an events.js file in my project...
Feb 17, 2021, 9:57 AM
I ended up changing the import paths manually. But now it works.
Feb 17, 2021, 11: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?