supabase icon indicating copy to clipboard operation
supabase copied to clipboard

Could not resolve dependency: peer react@"^16.8.0 || 17.x" from @reach/[email protected]

Open Drew-Daniels opened this issue 3 years ago • 3 comments

Bug report

Describe the bug

I am following the Quickstart: React tutorial for Supabase and at the step where we are asked to install @reach/visually-hidden, I get the following error in my terminal console:

Could not resolve dependency:
npm ERR! peer react@"^16.8.0 || 17.x" from @reach/[email protected]

To Reproduce

  1. Go to Quickstart: React tutorial
  2. Run the following commands:
  • npx create-react-app supabase-react
  • cd supabase-react
  • npm install @supabase/supabase-js
  • npm install @reach/visually-hidden
  1. See the following error:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR!   react@"^18.2.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.0 || 17.x" from @reach/[email protected]
npm ERR! node_modules/@reach/visually-hidden
npm ERR!   @reach/visually-hidden@"*" 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.
npm ERR! 
npm ERR! See /Users/<your-user>/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/<your-user>/.npm/_logs/2022-07-17T15_34_16_590Z-debug-0.log

Expected behavior

I would expect there to not be a dependency conflict error while following the tutorial.

Screenshots

image

System information

  • OS: macOS
  • Browser: NA
  • Version of supabase-js: 1.35.4
  • Version of Node.js: 16.15.1

Drew-Daniels avatar Jul 17 '22 15:07 Drew-Daniels

Hi @Drew-Daniels,

This issue is caused due to react 18 being used in the example. It appears that the @reach/visually-hidden library does not support react 18 yet but the maintainers are looking into this:

Pull Request Github Issue

As a workaround for now you can replace the <VisuallyHidden></VisuallyHidden> component with a div which does not display:

<div style={{display: "none"}}>
   <input
   type="file"
   id="single"
   accept="image/*"
   onChange={uploadAvatar}
   disabled={uploading}
   />
</div>

Just thinking it may be worth adding a note onto the docs to help others which I can do?

Hallidayo avatar Jul 19 '22 11:07 Hallidayo

Hi @Drew-Daniels,

This issue is caused due to react 18 being used in the example. It appears that the @reach/visually-hidden library does not support react 18 yet but the maintainers are looking into this:

Pull Request Github Issue

As a workaround for now you can replace the <VisuallyHidden></VisuallyHidden> component with a div which does not display:

<div style={{display: "none"}}>
   <input
   type="file"
   id="single"
   accept="image/*"
   onChange={uploadAvatar}
   disabled={uploading}
   />
</div>

Just thinking it may be worth adding a note onto the docs to help others which I can do?

Thanks for the context @Hallidayo ! That sounds good to me. I'd be happy to make a PR for this too if you'd rather.

Drew-Daniels avatar Jul 20 '22 23:07 Drew-Daniels

Hi @Drew-Daniels,

This issue is caused due to react 18 being used in the example. It appears that the @reach/visually-hidden library does not support react 18 yet but the maintainers are looking into this:

Pull Request Github Issue

As a workaround for now you can replace the <VisuallyHidden></VisuallyHidden> component with a div which does not display:

<div style={{display: "none"}}>
   <input
   type="file"
   id="single"
   accept="image/*"
   onChange={uploadAvatar}
   disabled={uploading}
   />
</div>

Just thinking it may be worth adding a note onto the docs to help others which I can do?

I went through the exact same issue and replacing with a div worked fine, thanks a lot.

bricejoosten avatar Jul 22 '22 11:07 bricejoosten

Hi @saltcod - I think this can be closed as its linked with #7828

Hallidayo avatar Oct 18 '22 08:10 Hallidayo

Yep for sure! Thanks @Hallidayo

saltcod avatar Oct 18 '22 11:10 saltcod