question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

npm7+ fails to install @sanity/base with react@17

See original GitHub issue

Describe the bug

A dependency of @sanity/base (react-sortable-hoc@^1.11.0) only supports react up to v16, resulting in an installation failure when it’s installed alongside react@17. Recommend to update it to react-sortable-hoc@2 for full react@17 support.

To Reproduce

Use npm7+ (i.e. node 15+) and install @sanity/base and react together

npm install @sanity/base@2.10.5 react@17.0.2

Then you’d get

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR!   react@"17.0.2" from the root project
npm ERR!   peer react@"^16.9 || ^17" from @sanity/base@2.10.5
npm ERR!   node_modules/@sanity/base
npm ERR!     @sanity/base@"2.10.5" from the root project
npm ERR!   11 more (react-dom, @reach/auto-id, @sanity/icons, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^0.14.0 || ^15.0.0 || ^16.0.0" from react-sortable-hoc@1.11.0
npm ERR! node_modules/@sanity/base/node_modules/react-sortable-hoc
npm ERR!   react-sortable-hoc@"^1.11.0" from @sanity/base@2.10.5
npm ERR!   node_modules/@sanity/base
npm ERR!     @sanity/base@"2.10.5" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

Expected behavior

No error. exit 0.

Which versions of Sanity are you using? 2.10.5

What operating system are you using? MacOS 11.3

Which versions of Node.js / npm are you running? node 16.2/npm 7.14

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:9
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
tbassettocommented, Jun 2, 2021

I have a similar issue but with @hot-loader/react-dom:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR!   react@"^17.0.2" from the root project
npm ERR!   peer react@"^16.9 || ^17" from @sanity/base@2.10.5
npm ERR!   node_modules/@sanity/base
npm ERR!     @sanity/base@"^2.10.5" from the root project
npm ERR!     @sanity/base@"2.10.5" from @sanity/default-layout@2.10.5       
npm ERR!     node_modules/@sanity/default-layout
npm ERR!       @sanity/default-layout@"^2.10.5" from the root project       
npm ERR!     3 more (@sanity/desk-tool, @sanity/field, @sanity/form-builder)
npm ERR!   14 more (@sanity/dashboard, @sanity/default-layout, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.14.0" from @hot-loader/react-dom@16.14.0
npm ERR! node_modules/@sanity/server/node_modules/@hot-loader/react-dom
npm ERR!   @hot-loader/react-dom@"^16.9.0-4.12.11" from @sanity/server@2.10.5
npm ERR!   node_modules/@sanity/server
npm ERR!     @sanity/server@"2.10.5" from @sanity/core@2.10.5
npm ERR!     node_modules/@sanity/core
npm ERR!       @sanity/core@"^2.10.5" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.```
  • node v14.16.0
  • npm 7.14.0
  • sanity 2.10.5
1reaction
W3Charlescommented, Nov 5, 2022

Error: Sanity currently only supports react@^16.2. Installed version: 17.0.2.

Run this in CLI: npm install react@latest react-dom@latest prop-types@latest

You can learn more about it here: https://www.sanity.io/help/upgrade-react

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to resolve dependency tree Reactjs - Stack Overflow
I installed npm v6.7. I reinstalled Netlify CMS and Gatsby: npm install netlify-cms-app@2.9 gatsby-plugin-netlify-cms@^4.0.0.
Read more >
@sanity/base - npm
Sanity plugin containing the base components and roles for a Sanity configuration. Latest version: 2.35.2, last published: a month ago.
Read more >
pnpm unmet peer - You.com | The search engine you control.
Describe the bug npm create sanity@dev-preview fails with unmet peer dependencies using pnpm. ; To Reproduce npm create sanity@dev-preview ; Expected behavior.
Read more >
How to Create and Publish a React Component Library
npm install react typescript @types/react --save-dev ... And finally, we will export all of our components from the base src directory:.
Read more >
Bug listing with status RESOLVED with resolution OBSOLETE ...
... does not compile against postgresql-base-8.2.17" status:RESOLVED ... Bug:341151 - "dev-util/devel-chroots fails post-install sanity check" ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found