🤍 전 강의 25% 할인 중 🤍

2024년 상반기를 돌아보고 하반기에도 함께 성장해요!
인프런이 준비한 25% 할인 받으러 가기 >>

  • 카테고리

    질문 & 답변
  • 세부 분야

    프론트엔드

  • 해결 여부

    해결됨

yarn generate오류

23.06.08 11:18 작성 조회수 282

0

$ yarn generate

yarn run v1.22.19

$ graphql-codegen

✔ Parse Configuration

⚠ Generate outputs

❯ Generate to ./src/commons/types/generated/typed.ts

✔ Load GraphQL schemas

✔ Load GraphQL documents

✖ Cannot use GraphQLObjectType "BoardReturn" from another module or realm.

Ensure that there is only one instance of "graphql" in the node_modules

directory. If d…

error Command failed with exit code 1.

info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

 

 

 

practice로 주소를 변경하고 yarn generate를 실행하는데 자꾸 위와같은 오류가 납니다 ㅠㅠ

답변 1

답변을 작성해보세요.

0

안녕하세요! 무연님!

무연님께서 설치하신 node_modules의 라이브러리에서 중복으로 graphql을 설치하는 라이브러리가 존재하는 것 같아요!

아래의 에러 메시지를 보시게 되면, graphql은 오직 1개여야 한다고 합니다!

Ensure that there is only one instance of "graphql" in the node_modules

directory.

여기서 말하는 오직 1개는 동일한 버전의 graphql을 말하는데요!
예를들면, 내가 설치한 graphql이 15버전이고, 내가 설치한 qqq라는 라이브러리에서 설치하는 graphql이 14버전인 경우 아래와 같습니다!
/node_modules/graphql => 15버전
/node_modules/qqq/node_modules/graphql => 14버전


이러한 경우, 두 graphql 버전을 일치시켜주셔야 하는데요!
이 때, package.json에서 resolutions라는 설정으로 일치시킬 수 있답니다!

// package.json

{
  "dependencies": {
    ...
  },
  "devDependencies": {
    ...
  },
  "resolutions": {
    "graphql": "공통으로 설치를 원하는 버전"
  }
}
채널톡 아이콘