`cf migrate` fails with `ERR_PNPM_IGNORED_BUILDS` in a pnpm workspace that has not approved workerd

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

Maintainer thường phản hồi trong vòng 1 ngày

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
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
build-system, cli

Hướng nghiên cứu

Read the cf migrate install path in installProjectDependencies from @cloudflare/codemods, then compare it with the build approval handling added for cf init and @cloudflare/autoconfig. Reproduce with the provided pnpm workspace and check pnpm-workspace.yaml behavior for existing entries, explicit false decisions, and --dry-run. Done means migration approves required builds before installing, or skips installation with clear approval guidance, without leaving a throwing generated config.

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

Mô tả

Summary of the issue

In a pnpm workspace whose pnpm-workspace.yaml does not approve workerd's build script, cf migrate writes cloudflare.config.ts and then fails when it installs cf. pnpm 12 rejects the install because workerd, a dependency of cf, has an unapproved build script. cf migrate exits with code 1 and writes throw new Error("Migration incomplete. …") into the generated cloudflare.config.ts.

cf init handles this since #92 (fixed in #136), and cloudflare/workers-sdk#16035 (PR cloudflare/workers-sdk#16054) adds the same approvals to @cloudflare/autoconfig. cf migrate installs through installProjectDependencies in @cloudflare/codemods, which neither change covers. @cloudflare/codemods 0.7.3, the version on main, has no build-approval step either.

Expected behaviour

When cf migrate installs with pnpm, it approves the builds that cf needs (workerd) in the active pnpm-workspace.yaml before it installs, as cf init does. It keeps existing entries and explicit false decisions, and writes nothing on --dry-run. If cf migrate cannot approve the builds, it skips the install and says which builds to approve, instead of writing a config that throws.

Version of cf used

1.0.0-beta.27

System information and package versions
  System:
    OS: macOS 27.0
    CPU: (14) arm64 Apple M4 Pro
    Memory: 412.20 MB / 48.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 26.13.0 - ~/.local/share/fnm/node-versions/v26.13.0/installation/bin/node
    npm: 11.20.0 - ~/.local/share/fnm/node-versions/v26.13.0/installation/bin/npm
    pnpm: 12.16.1 - /opt/homebrew/bin/pnpm
    bun: 1.4.4 - /opt/homebrew/bin/bun
    Deno: 2.9.8 - /opt/homebrew/bin/deno
    Watchman: 2026.10.26.00 - /opt/homebrew/bin/watchman
  npmPackages:
    cf: 1.0.0-beta.27 => 1.0.0-beta.27
Reproduction (optional)
  1. Create these files:
    • package.json: { "name": "cf-migrate-pnpm-repro", "private": true }
    • pnpm-workspace.yaml: packages: ["apps/*"] (no allowBuilds)
    • apps/worker/package.json: { "name": "worker", "private": true, "type": "module" }
    • apps/worker/wrangler.jsonc: { "name": "worker", "main": "src/index.js", "compatibility_date": "2026-11-01" }
    • apps/worker/src/index.js: export default { fetch() { return new Response("Hello"); } };
  2. Run pnpm install at the root.
  3. In apps/worker, run pnpm dlx cf@latest migrate.

cf migrate exits with code 1. cloudflare.config.ts contains the throw, and pnpm-workspace.yaml is unchanged.

Workaround: approve workerd first (allowBuilds: { workerd: true } in pnpm-workspace.yaml), then cf migrate completes and writes no throw. Or run cf migrate --no-install and install cf yourself.

Relevant error logs (optional)
Using the Wrangler bundler because @cloudflare/vite-plugin is not declared. Pass --bundler vite to override.
Updated 3 file(s):
├─ cloudflare.config.ts
├─ package.json
└─ ../../pnpm-lock.yaml

Follow-up work:
└─ [required] The generated configuration was written, but `cf` could not be installed automatically. Install `cf@latest` with your package manager before using it. Installation failed: …

devDependencies:
+ cf 1.0.0-beta.27

Error: ERR_PNPM_IGNORED_BUILDS

  × adding a new package
  ╰─▶ Ignored build scripts: [email protected]
  help: Run "pnpm approve-builds" to pick which dependencies should be allowed
        to run scripts.

⚠ Migration requires follow-up work.
Ngôn ngữ chính
TypeScript
Star
993
Fork
65
Merge trung bình
18 giờ 28 phút
Pull request đã merge (30 ngày)
207

Chuẩn bị môi trường

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 cloudflare/cf

Tất cả issue của cloudflare/cf

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.