728x90
현상
이미 작성된 node.js 프로젝트를 열어 npm install / npm i 명령어를 입력했을때 package.json 에 작성한것들이 설치되어야하는데 정상적으로 설치되지 않고 아래와 같은 오류를 뱉으며 종료된다.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
,,,
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!
결국 오류는 문제 속에 답이 있다.
dependency를 수정하거나
--force 나 --legacy-peer-deps 옵션을 주어 재 시도해보라고 하는데,
--force 와 --legacy-peer-deps 중 아무거나 사용해도 상관없는 걸까.
--force 사용시, package-lock.json파일에 몇가지 의존 버전들을 추가하여 강제로 충돌을 우회하도록 하는 방법이다.
--legacy-peer-deps 사용시 peerDependency가 맞지 않아도 충돌을 무시하고 일단 설치하는 방법이다.
보통은 legacy로 실행해보고 실행이 되면 충돌났던 것들을 추후에 개선해가는 방식으로 진행하는 것이 안전하다고 생각이든다.
npm i --legacy-peer-deps
위 명령어로 재 세팅 진행시 정상적으로 설치 되어 실행이 가능한 상태가 되었다.
반응형
'Etc > Problem Solving' 카테고리의 다른 글
ssh key 연결 시 pem 키 오류 Permission denied (publickey). (0) | 2024.01.08 |
---|---|
ssh key 연결 시 pem 키 오류 pem not accessible: No such file or directory. (0) | 2024.01.08 |
[Linux] ip: command not found 오류 해결 방법 (2) | 2022.06.07 |
[SpringBoot] intelliJ @SpringBootApplication cannot find 에러 (0) | 2021.06.30 |
[SpringBoot] intelliJ - Spring configuration checkUnmapped Spring configuration files found 에러 (0) | 2021.06.30 |