Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Corepack hardcodes pnpm binary path instead of reading package.json bin field (breaks with pnpm v11)

Đang mở
#775 8 bình luận 3 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
66/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ệ
nodejs, typescript
Lĩnh vực
cli, tooling

Hướng nghiên cứu

Bắt đầu bằng cách lần theo quá trình phân giải pnpm và lựa chọn tệp thực thi của Corepack, sau đó so sánh đường dẫn được hard-code với trường bin trong package.json của pnpm. Tái hiện với Node.js 20, Corepack 0.34.4 và pnpm v11; được coi là hoàn tất khi pnpm v11 bắt đầu sử dụng mục nhập bin/pnpm.mjs của nó và các phiên bản pnpm hiện có vẫn hoạt động.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

After some discussion on the pnpm issue (https://github.com/pnpm/pnpm/issues/10214), it turns out the problem is not caused by a faulty pnpm release, pnpm v11 has changed its binary entry path from bin/pnpm.cjs to bin/pnpm.mjs., so the development build 11.0.0-dev.1005 is not faulty. Corepack is expecting the old path and fails.

So the issue appears to be:

  • Corepack’s version resolution prefers a dev build over the latest stable
  • Corepack seems to rely on a hardcoded pnpm binary path instead of reading the correct bin path from package.json.

As a workaround I'm currently using corepack use pnpm@10.22.0 or corepack use pnpm@latest (or latest-9, latest-10 etc.)

Leaving this update here so the root cause is clearer.

Originally posted by @tkesici in #772

Problem

Corepack appears to rely on a hard-coded pnpm binary path (bin/pnpm.cjs) instead of reading the bin field from pnpm’s package.json.

pnpm v11 changed its binary entry from bin/pnpm.cjs to bin/pnpm.mjs (https://github.com/pnpm/pnpm/issues/10214#issuecomment-3566728733), so when corepack installs pnpm v11, pnpm cannot start and the process fails.

Expected Behavior

Corepack should read the bin property from pnpm’s package.json to determine the correct executable path

Actual Behavior

Corepack assumes the binary always exists under bin/pnpm.cjs, which is no longer valid for pnpm v11.

Environment

Node.js: 20 (node:20-alpine)

Corepack: 0.34.4

OS: Alpine Linux

Ngôn ngữ chính
TypeScript
Star
3.8k
Fork
279
Merge trung bình
1 giờ 47 phút
Pull request đã merge (30 ngày)
2

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của nodejs/corepack

Tất cả issue của nodejs/corepack

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.