
next.js로 작업중 fetch() 대신 axios를 쓰기 위해
터미널에 npm install axios를 하니 나오는 에러..
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: swr@0.4.2
npm ERR! Found: react@18.2.0
npm ERR! node_modules/react
npm ERR! peer react@"^18.2.0" from next@13.2.3
npm ERR! node_modules/next
npm ERR! next@"^13.2.3" from the root project
npm ERR! peer react@"^18.2.0" from react-dom@18.2.0
npm ERR! node_modules/react-dom
npm ERR! peer react-dom@"^18.2.0" from next@13.2.3
npm ERR! node_modules/next
npm ERR! next@"^13.2.3" from the root project
npm ERR! react-dom@"^18.2.0" from the root project
npm ERR! 2 more (styled-jsx, the root project)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.11.0 || ^17.0.0" from swr@0.4.2
npm ERR! node_modules/swr
npm ERR! swr@"^0.4.2" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react@17.0.2
npm ERR! node_modules/react
npm ERR! peer react@"^16.11.0 || ^17.0.0" from swr@0.4.2
npm ERR! node_modules/swr
npm ERR! swr@"^0.4.2" 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/yoointae/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/yoointae/.npm/_logs/2023-03-06T01_25_51_059Z-debug-0.log
찾아보니 종속성 문제인듯 하다.
stackoverflow에서 찾아보니 누구는 npm 설치 --force하면 된다고 하지만(이렇게 해도 에러가 해결되긴 한다.)
이렇게 할경우 응용프로그램에서 충돌이 발생할 수 있으니,
npm config set legacy-peer-deps true을 입력하면 에러 해결!!
'Error' 카테고리의 다른 글
| React - TypeError: Cannot read property 'map' of undefined (0) | 2023.03.07 |
|---|---|
| Next.JS - Error: Invalid <Link> with <a> child. Please remove <a> or use <Link legacyBehavior> (0) | 2023.03.07 |
| Next.JS - Parsing error: Cannot find module 'next/babel' (0) | 2023.02.15 |
| Firebase - deploy Error(1) (0) | 2023.01.30 |