개발/공유
package.json dependency overrides
hue-yoo
2024. 3. 18. 10:29
얼마전에 팀을 이동하게 되었다. 이동하면서 새로운 레포를 다운로드 하고, package.json을 살펴보는데..
딱히 특별한건 보이지 않았다.
npm으로 install 하고 실행햐야지? 했는데.. install에서 에러...
code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: react-scripts@5.0.1
npm ERR! Found: typescript@5.0.4
npm ERR! node_modules/typescript
npm ERR! typescript@"^5.0.4" from the root project
npm ERR! peer typescript@">= 2.7" from fork-ts-checker-webpack-plugin@6.5.2
npm ERR! node_modules/fork-ts-checker-webpack-plugin
npm ERR! fork-ts-checker-webpack-plugin@"^6.5.0" from react-dev-utils@12.0.1
npm ERR! node_modules/react-dev-utils
npm ERR! react-dev-utils@"^12.0.1" from react-scripts@5.0.1
npm ERR! node_modules/react-scripts
npm ERR! react-scripts@"5.0.1" from the root project
npm ERR! 1 more (tsutils)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional typescript@"^3.2.1 || ^4" from react-scripts@5.0.1
npm ERR! node_modules/react-scripts
npm ERR! react-scripts@"5.0.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: typescript@4.9.5
npm ERR! node_modules/typescript
npm ERR! peerOptional typescript@"^3.2.1 || ^4" from react-scripts@5.0.1
npm ERR! node_modules/react-scripts
npm ERR! react-scripts@"5.0.1" 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.
react-script 5.0.1 버전에서 사용할 수 있는 TypeScript 버전은 3.2.1 이후 최대 4버전 까지인데 현재 설치된 TypeScript 버전은 5.0.4 버전이기 때문에 생긴 오류이다.
이미 이슈로도 올라와있었다.. https://github.com/facebook/create-react-app/issues/13080
(react-scripts) Support for TypeScript 5.x · Issue #13080 · facebook/create-react-app
Describe the bug After npx create-react-app frontend --template typescript, when you update package.json to use "typescript": "^5.0.2",, npm install <any package> fails with this error: $ npm i rea...
github.com
"overrides": {
"typescript": "^5.3.3"
},
으로 추가, 해결완료...