리액트 버전을 올린 후 라이브러리 설치 시 종종 종속성(dependency) 에러가 발생한다
사용하려는 라이브러리에서 필요로 하는 리액트 버전과 사용하고 있는 리액트의 버전이 맞지 않기 떄문
$ npm i react-beautiful-dnd
> npm ERR! code ERESOLVE
> npm ERR! ERESOLVE unable to resolve dependency tree
> npm ERR!
> npm ERR! While resolving: react-todo-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@"^16.8.5 || ^17.0.0" from react-beautiful-dnd@13.1.0
> npm ERR! node_modules/react-beautiful-dnd
> npm ERR! react-beautiful-dnd@"*" 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/kimjinhui/.npm/eresolve-report.txt for a full report.
> npm ERR! A complete log of this run can be found in:
> npm ERR! /Users/kimjinhui/.npm/_logs/2022-08-10T04_40_58_609Z-debug-0.log
리액트 버전 다운그레이드 하지 않고 해결
yarn으로 설치
$ yarn add react-beautiful-dnd
npm err 안내에 따라 강제 설치 옵션으로 설치
-for--force--legacy-peer-deps