저장을 습관화
에러 기록 - Could not resolve dependency: @nestjs/typeorm@"*" from the root project 본문
공부/node.js
에러 기록 - Could not resolve dependency: @nestjs/typeorm@"*" from the root project
ctrs 2023. 11. 11. 20:40- 증상
nestjs에서 typeorm을 사용하기 위해 패키지 설치 중 에러가 발생
$ npm install --save @nestjs/typeorm typeorm mysql2
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: a-nest@0.0.1
npm ERR! Found: typeorm@0.2.45
npm ERR! node_modules/typeorm
npm ERR! typeorm@"^0.2.37" from typeorm-model-generator@0.4.6
npm ERR! node_modules/typeorm-model-generator
npm ERR! typeorm-model-generator@"^0.4.6" from the root project
npm ERR! typeorm@"*" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! @nestjs/typeorm@"*" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: typeorm@0.3.17
npm ERR! node_modules/typeorm
npm ERR! peer typeorm@"^0.3.0" from @nestjs/typeorm@10.0.0
npm ERR! node_modules/@nestjs/typeorm
npm ERR! @nestjs/typeorm@"*" 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:\(중략)\npm-cache\_logs\2023-11-11T11_11_04_678Z-eresolve-report.txt
npm ERR! A complete log of this run can be found in: C:\(중략)\npm-cache\_logs\2023-11-11T11_11_04_678Z-debug-0.log
내용은 '@nestjs/typeorm' 패키지와 'typeorm-model-generator' 패키지의 버전 충돌로 인한 의존성 문제가 원인
- 원인
'@nestjs/typeorm' 패키지는 설치에 필요한 사전 패키지로 0.3.0 버전 이상의 'typeorm'의 설치를 진행하려고 하였으나
'typeorm-model-generator'는 0.2.37 버전 이상의 'typeorm'을 요구하고 있어 발생한 에러
- 해결
'typeorm-model-generator' 패키지는 기존에 존재하던 데이터베이스의 스키마를 읽어와
타입스크립트 형태의 엔티티 및 레포지터리를 작성해주는 편의성 도구
현재 나의 상황은 typeorm을 통해 새로운 DB를 생성하고 있는 중이고,
더 이상 이 패키지를 사용하지 않을 것으로 생각되니 제거하도록 결정
$ npm uninstall typeorm-model-generator
removed 223 packages, and audited 730 packages in 3s
130 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
정상 제거 완료
다시 @nestjs/typeorm 설치
$ npm install --save @nestjs/typeorm typeorm mysql2
added 37 packages, and audited 767 packages in 53s
135 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
정상 설치 완료
다행히 필수적인 패키지끼리 충돌하는 에러가 아니라서 금방 해결할 수 있었다
'공부 > node.js' 카테고리의 다른 글
NestJS TypeORM 연습 기록 - DB 생성, 테이블 생성, seeding(초기 데이터 입력) (0) | 2023.11.12 |
---|---|
NestJS - TypeORM을 위한 app.module.ts 설정 기록 (0) | 2023.11.11 |
NestJS - 컨트롤러 constructor에 private readonly를 설정하는 이유 (0) | 2023.11.09 |
NestJS - 인터셉터와 AOP (0) | 2023.11.09 |
NestJS - DTO를 인터페이스가 아닌 클래스로 선언하는 이유 (0) | 2023.11.06 |