서버파일에서 node 모듈 설치위한
npm i 하면 밑과 같은 에러출력
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @mochajs/json-file-reporter@1.3.0
npm ERR! Found: mocha@10.0.0
npm ERR! node_modules/mocha
npm ERR! dev mocha@"^10.0.0" from the root project
npm ERR! peer mocha@">=3.1.2" from mocha-multi-reporters@1.5.1
npm ERR! node_modules/mocha-multi-reporters
npm ERR! dev mocha-multi-reporters@"^1.5.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer mocha@"6.x || 7.x || 8.x" from @mochajs/json-file-reporter@1.3.0
npm ERR! node_modules/@mochajs/json-file-reporter
npm ERR! dev @mochajs/json-file-reporter@"^1.3.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: mocha@8.4.0
npm ERR! node_modules/mocha
npm ERR! peer mocha@"6.x || 7.x || 8.x" from @mochajs/json-file-reporter@1.3.0
npm ERR! node_modules/@mochajs/json-file-reporter
npm ERR! dev @mochajs/json-file-reporter@"^1.3.0" 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/mun/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/mun/.npm/_logs/2022-07-14T03_57_00_674Z-debug-0.log
리액트 프로젝트 세팅시 항상 최신버전 설치되므로, 다른 라이브러리와 호환안됨
리액트 버전 변경해야할 때가 있음
package.json 에서 라이브러리 버전을 호환되는 버전으로 맞추거나
--save --legacy-peer-deps
뒤에 입력하기
: 기존버전 무시하고 설치한다는 뜻
npm install --save --legacy-peer-deps
npm install --force