Software Frontend/react & Javascript

React Downgrade(버전 낮추는) 방법

light_meal 2021. 6. 1. 22:03
728x90

React Downgrade

react-scroll-into-view 를 사용하기 위해 설치하려 했는데 react 버전 때문에 사용하지 못한다고 하여 버전을 낮추려고 합니다.

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: react_portfolio@0.1.0    
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR!   react@"^17.0.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.5.2" from react-scroll-into-view@1.9.4
npm ERR! node_modules/react-scroll-into-view
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 C:\Users\kyung\AppData\Local\npm-cache\eresolve-report.txt for a full report.

 

 

해결 방법

다음 코드가 다운 그레이드 하는 코드입니다.

npm install --save react@^16.14.0 react-dom@16.14.0

React 버전은 위 오류에 나오는 버전을 맞춰도 되고, 따로 버전을 찾고자 할 경우

https://reactjs.org/versions 여기서 확인하면 되겠습니다.

 

모든 프레임워크와 라이브러리는 무조건 최신버전이 최선의 선택이 아님을 다시 한 번 느끼게 됩니다.

 

React - Versions

A JavaScript library for building user interfaces

reactjs.org

 

 

react 버전 다운그레이드 후 정상적으로 scroll-into-view가 정상적으로 다운된 것을 알 수 있다.

728x90