malte-wessel / react-textfit

React component to fit headlines and paragraphs into elements
http://malte-wessel.github.io/react-textfit/
MIT License
469 stars 143 forks source link

Not compatible with React ^17 #86

Open riceball1 opened 2 years ago

riceball1 commented 2 years ago

Tried this with react ^17.0.2 installed, but got the following error when trying to npm i react-textfit

Could not resolve dependency:
npm ERR! peer react@"^15.0.0 || ^16.0.0" from react-textfit@1.1.1
npm ERR! node_modules/react-textfit
npm ERR!   react-textfit@"*" from the root project
abhishek0010 commented 2 years ago

Should work with--force

Jennydunix commented 1 year ago

@abhishek0010 thank you! it worked for me

pberlia0202 commented 1 year ago

can you tell where to add --force in the command npm i react-textfit

pberlia0202 commented 1 year ago

i m getting the same problem

Jennydunix commented 1 year ago

@pberlia0202 here's what I did

npm i react-textfit --force

pberlia0202 commented 1 year ago

PS C:\Users\pberl\OneDrive\Desktop\my-calc> npm i react-textfit --force npm WARN using --force Recommended protections disabled. npm WARN ERESOLVE overriding peer dependency npm WARN While resolving: react-textfit@1.1.1 npm WARN Found: react@18.2.0 npm WARN node_modules/react npm WARN peer react@"^18.0.0" from @testing-library/react@13.4.0 npm WARN node_modules/@testing-library/react npm WARN @testing-library/react@"^13.4.0" from the root project npm WARN 2 more (react-dom, the root project) npm WARN npm WARN Could not resolve dependency: npm WARN peer react@"^15.0.0 || ^16.0.0" from react-textfit@1.1.1 npm WARN node_modules/react-textfit npm WARN react-textfit@"^1.1.1" from the root project npm WARN npm WARN Conflicting peer dependency: react@16.14.0 npm WARN node_modules/react npm WARN peer react@"^15.0.0 || ^16.0.0" from react-textfit@1.1.1 npm WARN node_modules/react-textfit npm WARN react-textfit@"^1.1.1" from the root project npm WARN ERESOLVE overriding peer dependency npm WARN While resolving: react-textfit@1.1.1 npm WARN Found: react-dom@18.2.0 npm WARN node_modules/react-dom npm WARN peer react-dom@"^18.0.0" from @testing-library/react@13.4.0 npm WARN node_modules/@testing-library/react npm WARN @testing-library/react@"^13.4.0" from the root project npm WARN 1 more (the root project) npm WARN npm WARN Could not resolve dependency: npm WARN peer react-dom@"^15.0.0 || ^16.0.0" from react-textfit@1.1.1 npm WARN node_modules/react-textfit npm WARN react-textfit@"^1.1.1" from the root project npm WARN npm WARN Conflicting peer dependency: react-dom@16.14.0 npm WARN node_modules/react-dom npm WARN peer react-dom@"^15.0.0 || ^16.0.0" from react-textfit@1.1.1 npm WARN react-textfit@"^1.1.1" from the root project

pberlia0202 commented 1 year ago

This os the problem I m gettinng after using npm i react-textfit --force

pberlia0202 commented 1 year ago

also after using --force, localhost stops working

Jennydunix commented 1 year ago

Ok let's try again run the command npm install react-textfit --save on your terminal

pberlia0202 commented 1 year ago

PS C:\Users\pberl\OneDrive\Desktop\my-app> npm install react-textfit --save npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: my-app@0.1.0 npm ERR! Found: react@18.2.0 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@"^15.0.0 || ^16.0.0" from react-textfit@1.1.1 npm ERR! node_modules/react-textfit npm ERR! react-textfit@"*" 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! npm ERR! For a full report see: npm ERR! C:\Users\pberl\AppData\Local\npm-cache_logs\2023-03-16T15_06_56_708Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\pberl\AppData\Local\npm-cache_logs\2023-03-16T15_06_56_708Z-debug-0.log

Jennydunix commented 1 year ago

I just tried it out on my react application and it worked

QASIMMIRZA-007 commented 6 months ago

i was facing this same issue . After research i come to know that npm install react-textfit --save -force works and required module installed other wise you can try npm i react-textfit --save --legacy-peer-deps but my recommendation is npm install react-textfit --save -force.

jujharsingh2802 commented 2 months ago

For me the problem is coming on deployment on vercel

jujharsingh2802 commented 2 months ago

The problem I encountered was not in the app rather in deployement, but the problem was resolved after I downgraded my react version