Skip to content

Chapter 22 이후 mongoose import 이슈 #381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
velopert opened this issue Apr 23, 2023 · 0 comments
Open

Chapter 22 이후 mongoose import 이슈 #381

velopert opened this issue Apr 23, 2023 · 0 comments
Labels
고정 해결됐으나, 쉽게 참고 할 수 있도록 고정

Comments

@velopert
Copy link
Owner

Chapter 22 이후 mongoose를 import 하면

node_modules/mongodb/lib/collection.js:70
            pkFactory: db.options?.pkFactory ?? utils_1.DEFAULT_PK_FACTORY,
                                  ^

오류가 발생합니다.

esm 패키지가 mongoose와 충돌하는 것으로 보이는데요,

mongoose 버전을 6.10.5 버전으로 고정하여 설치하시면 해결됩니다.

mongoose의 최신 버전을 사용하려면, esm 을 지우고 require() 로만 불러오거나,
프로젝트에 ESM을 Node.js의 .mjs 확장자를 사용하거나 --experimental-modules flag를 활용해야하는데 그렇게 할 시 수정해야 할 코드가 너무 많아서 mongoose 다운그레이드 하는 방식을 안내드립니다.

@velopert velopert added the 고정 해결됐으나, 쉽게 참고 할 수 있도록 고정 label Apr 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
고정 해결됐으나, 쉽게 참고 할 수 있도록 고정
Projects
None yet
Development

No branches or pull requests

1 participant