MongoDB template fails under npm: ERESOLVE between mongodb@^7 (@prisma/orm-mongo) and alchemy's peerOptional mongodb@^6.10
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 55/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- mongodb, node.js, typescript
Hướng nghiên cứu
Start by reproducing the documented npm create command and compare it with the successful pnpm run. Inspect the MongoDB template's dependency generation and install path, especially how alchemy and mongodb versions are selected. Done means npm installs the template successfully without ERESOLVE and without leaving a partial project; add a regression check if the existing test structure supports one.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
npm create prisma@latest -- <name> --template nest --provider mongodb fails during dependency installation with an ERESOLVE peer-dependency conflict. The generated package.json requires mongodb@^7.1.0 (and @prisma/[email protected] declares peer mongodb@^7.0.0), while [email protected], pulled in by @prisma/[email protected] and @prisma/[email protected], declares peerOptional mongodb@^6.10.0. npm refuses the resolution and leaves a half-generated project behind.
The same command with --package-manager pnpm succeeds, so the templates themselves are fine; the problem is npm's strict peer resolution against alchemy's peer range.
Reproduction
node -v # v24.11.1
npm -v # 11.6.2
npm create [email protected] -- nest-mongo --template nest --provider mongodb --yes --no-deploy
Output (trimmed):
npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: [email protected]
npm error Found: [email protected]
npm error node_modules/mongodb
npm error mongodb@"^7.1.0" from the root project
npm error peer mongodb@"^7.0.0" from @prisma/[email protected]
npm error node_modules/@prisma/orm-mongo
npm error @prisma/orm-mongo@"8.0.0-rc.11" from the root project
npm error 2 more (@prisma/orm-family-mongo, @prisma/orm-target-mongo)
npm error
npm error Could not resolve dependency:
npm error peerOptional mongodb@"^6.10.0" from [email protected]
npm error node_modules/alchemy
npm error alchemy@"2.0.0-beta.74" from the root project
npm error alchemy@"2.0.0-beta.74" from @prisma/[email protected]
npm error node_modules/@prisma/composer
npm error @prisma/composer@"0.20.0" from the root project
npm error 1 more (@prisma/composer-prisma-cloud)
npm error
npm error Conflicting peer dependency: [email protected]
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
After the failure the target directory contains only package.json, tsconfig.json, and six src/*.ts files: no src/prisma/, no node_modules, no module.ts/service.ts.
Reproduced twice on 2026-09-24 (once with [email protected] from the npx cache, once with 0.13.2). The PostgreSQL template with the same flags installs cleanly under npm, and the MongoDB template installs cleanly with --package-manager pnpm:
npm create [email protected] -- nest-mongo --template nest --provider mongodb --package-manager pnpm --yes --no-deploy
# Prisma 8 project ready.
Relevant versions in the generated project
"@prisma/composer": "0.20.0",
"@prisma/composer-prisma-cloud": "0.20.0",
"@prisma/orm-mongo": "8.0.0-rc.11",
"alchemy": "2.0.0-beta.74",
"mongodb": "^7.1.0"
[email protected] (current latest) still declares peerDependencies.mongodb: "^6.10.0", so bumping the pinned alchemy version alone does not resolve it.
Expected behavior
The MongoDB template installs under npm, which is the package manager the docs lead with (npm create prisma@latest -- my-app).
Possible fixes
- Add an npm
overridesentry formongodb(or run the npm install step with--legacy-peer-deps) in the MongoDB template untilalchemywidens its peer range. - Ask upstream
alchemyto declarepeerOptional mongodb@"^6.10.0 || ^7.0.0", since the peer is optional and Composer does not use the MongoDB provider fromalchemyhere. - At minimum, fail before writing files, or print the pnpm workaround, so users are not left with a half-generated directory.
Context
Hit while verifying the "Prisma ORM 8 in NestJS" blog post; the post currently pins --package-manager pnpm for the MongoDB command as a workaround.
- Ngôn ngữ chính
- TypeScript
- Star
- 12
- Fork
- 0
- Merge trung bình
- 43 phút
- Pull request đã merge (30 ngày)
- 8
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của prisma/create-prisma
-
bug
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
prisma/create-prisma#108 ·
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 58/100
prisma/create-prisma#107 ·
Tất cả issue của prisma/create-prisma
Issue tương tự
-
dream report: normalizeMutation discards ok/status, consumers can only string-match the summaryĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
thecodacus/understory#61 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Termix-SSH/Plugin-Hosts-Config#14 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
ai-generated priority: p2 size: s type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
JonathanTSilva/jts-website#92 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Toast announcer reads a doubled period when a toast's title ends in punctuationCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
vercel-labs/ui#999 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
ehmpathy/rhachet-roles-ehmpathy#1443 ·
Maintainer thường phản hồi trong vòng 1 ngày