개발 블로그
[react/에러]npm ERR! code ERESOLVEnpm ERR! ERESOLVE could not resolve 본문
상황: 협업할 때 프로젝트를 빌드하기 전에 npm install을 하려고 하는데 자꾸 아래 에러가 떳다.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: react-avatar-uploader@1.0.3
npm ERR! Found: react@18.2.0
npm ERR! node_modules/react
npm ERR! react@"^18.2.0" from the root project
npm ERR! peer react@">=16.0.0" from @ant-design/cssinjs@1.5.6
npm ERR! node_modules/@ant-design/cssinjs
npm ERR! @ant-design/cssinjs@"^1.5.6" from antd@5.2.0
npm ERR! node_modules/antd
npm ERR! antd@"^5.1.7" from the root project
npm ERR! 63 more (@ant-design/icons, @ant-design/react-slick, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.4.1" from react-avatar-uploader@1.0.3
npm ERR! node_modules/react-avatar-uploader
npm ERR! react-avatar-uploader@"^1.0.3" 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\82104\AppData\Local\npm-cache\_logs\2023-02-09T17_44_27_032Z-eresolve-report.txt
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\82104\AppData\Local\npm-cache\_logs\2023-02-09T17_44_27_032Z-debug-0.log
일단 뭔가 버전 문제인 것 같았다.
react-avatar-uploader와 react의 버전이 안 맞는 것 같아서
package.json에서 react-avatar-uploader 버전을 바꿔도 보고
react-avatar-uploader의 package.json 에서 react도 바꿔봤지만 더 많아진 에러들..
단순히 한 라이브러리의 버전 문제가 아니라,, 자체 버전 문제인 것 같아서
결국 node.js와 npm 버전 문제였다..!
3시간의 삽질이.. node.js 버전 문제였다니..
나는 이전 node.js을 삭제하기 귀찮아서 아래 사이트를 참고해 원하는 node.js 버전을 설치하고 사용했다.
https://github.com/coreybutler/nvm-windows/releases
Releases · coreybutler/nvm-windows
A node.js version management utility for Windows. Ironically written in Go. - coreybutler/nvm-windows
github.com
원래 내 node.js 버전: 18.14.0
nvm install 14.17.5로 다운그레이드 했다.
node.js 버전은 바꿨지만 npm 버전은 안바뀌어서 직접 바꿔줬다.
npm install -g npm@6.14.14
이렇게 하고 npm install을 하니 제대로 설치되었다!!!!!!
깃허브에 올라온 코드의 npm의 버전이 다른 버전이였던 것 같다.
물론 나와 같은 버전으로 바꾼다고 해결될 건 아니겠지만, 그래도 node.js와 npm 버전의 문제일 수도 있다는 가능성을 열어두길..
이번 일로
1. 협업에서 버전 관리의 중요성을 너무 잘 알게 되었고,
2. node.js 버전 문제인걸 늦게 알았는데 위와 같은 에러가 뜬다면 버전을 확인하자!
'개인 공부' 카테고리의 다른 글
[springboot/에러해결]nullpointerException, BeanInstantiationException 에러 (0) | 2023.03.18 |
---|---|
[에러 해결]npm WARN fork-ts-checker-webpack-plugin@6.5.2 requires a peer of typescript@>= 2.7 but none is installed. You must install peer dependencies yourself. (0) | 2023.02.12 |
[springboot/에러 해결]nohup 에러 (0) | 2023.02.03 |
[unity]유니티 사용 방법/용어 정리 (0) | 2022.12.29 |
[개인공부/json] json 개념과 사용 방법 (0) | 2022.11.29 |