react-google-login icon indicating copy to clipboard operation
react-google-login copied to clipboard

Add support for react 18

Open SebastiaanNijland opened this issue 2 years ago • 12 comments

When trying to upgrade to react 18, we are running into this Error:

error TS2786: 'GoogleLogin' cannot be used as a JSX component.

  Its instance type 'GoogleLogin' is not a valid JSX element.

    The types returned by 'render()' are incompatible between these types.

      Type 'import("/drone/src/node_modules/@types/react-transition-group/node_modules/@types/react/index").ReactNode' is not assignable to type 'React.ReactNode'.

error Command failed with exit code 2.

SebastiaanNijland avatar Apr 18 '22 08:04 SebastiaanNijland

I can't properly install react-google-login alongside React v18. I have tried using the legacy-peer-deps flag but it resulted in more issues down the line with my other modules. Adding support for React's new version would be appreciated.

>npm i react-google-login
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.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16 || ^17" from [email protected]
npm ERR! node_modules/react-google-login
npm ERR!   react-google-login@"*" 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 ...\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     ...\AppData\Local\npm-cache\_logs\2022-04-19T07_08_54_572Z-debug-0.log

Infinitay avatar Apr 19 '22 07:04 Infinitay

Bump

ecoulson avatar May 09 '22 03:05 ecoulson

Same

sumeyradavran avatar May 09 '22 13:05 sumeyradavran

Same.

bautista1405 avatar May 10 '22 22:05 bautista1405

Same.

I could install it with the "--force" flag. Below I leave the logs:

$ npm install react-google-login --force npm WARN using --force Recommended protections disabled. npm WARN ERESOLVE overriding peer dependency npm WARN While resolving: [email protected] npm WARN Found: [email protected] npm WARN node_modules/react npm WARN peer react@">=16.8.0" from @nextui-org/[email protected] npm WARN node_modules/@nextui-org/react npm WARN @nextui-org/react@"^1.0.0-beta.6" from the root project npm WARN 6 more (@stitches/react, formik, next, react-dom, styled-jsx, the root project) npm WARN npm WARN Could not resolve dependency: npm WARN peer react@"^16 || ^17" from [email protected] npm WARN node_modules/react-google-login npm WARN react-google-login@"" from the root project npm WARN npm WARN Conflicting peer dependency: [email protected] npm WARN node_modules/react npm WARN peer react@"^16 || ^17" from [email protected] npm WARN node_modules/react-google-login npm WARN react-google-login@"" from the root project npm WARN ERESOLVE overriding peer dependency npm WARN While resolving: [email protected] npm WARN Found: [email protected] npm WARN node_modules/react-dom npm WARN peer react-dom@">=16.8.0" from @nextui-org/[email protected] npm WARN node_modules/@nextui-org/react npm WARN @nextui-org/react@"^1.0.0-beta.6" from the root project npm WARN 2 more (next, the root project) npm WARN npm WARN Could not resolve dependency: npm WARN peer react-dom@"^16 || ^17" from [email protected] npm WARN node_modules/react-google-login npm WARN react-google-login@"" from the root project npm WARN npm WARN Conflicting peer dependency: [email protected] npm WARN node_modules/react-dom npm WARN peer react-dom@"^16 || ^17" from [email protected] npm WARN node_modules/react-google-login npm WARN react-google-login@"" from the root project

added 5 packages, and audited 384 packages in 4s

68 packages are looking for funding run npm fund for details

found 0 vulnerabilities

bautista1405 avatar May 10 '22 23:05 bautista1405

same here

itsjinendrajain avatar May 13 '22 18:05 itsjinendrajain

+1

senkiv-n avatar May 16 '22 07:05 senkiv-n

you can check @react-oauth/google

MomenSherif avatar May 16 '22 09:05 MomenSherif

I'd love to see a version compatible with React 18!

ameyalambat128 avatar Jun 29 '22 07:06 ameyalambat128

While we wait for this, hopefully this helps.

npm uninstall react-google-login
npm install @leecheuk/react-google-login

@leecheuk/react-google-login is a fork of anthonyjgrove/react-google-login and has plugin_name support & updated peerDependency for React 18.

leecheuk avatar Jul 17 '22 21:07 leecheuk

Has this issue been resolved? As I got the same error but used @leecheuk's solution. Thx btw

GH0ST555 avatar Aug 15 '23 09:08 GH0ST555

Looks like this repo is no longer maintained

SebastiaanNijland avatar Aug 15 '23 09:08 SebastiaanNijland