`cf migrate` fails with `ERR_PNPM_IGNORED_BUILDS` in a pnpm workspace that has not approved workerd
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 55/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- build-system, cli
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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)
- Create these files:
package.json:{ "name": "cf-migrate-pnpm-repro", "private": true }pnpm-workspace.yaml:packages: ["apps/*"](noallowBuilds)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"); } };
- Run
pnpm installat the root. - In
apps/worker, runpnpm 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.
- 主要语言
- TypeScript
- 星标
- 993
- 派生
- 65
- 平均合并
- 21 小时 47 分钟
- 30 天内合并 PR
- 209
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
cloudflare/cf 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
cloudflare/cf#532 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
cloudflare/cf#344 ·
维护者通常 1 天内回复
-
upstream
难度 2/5 1-3 小时 新手友好度 72/100
cloudflare/cf#262 ·
维护者通常 1 天内回复
-
`cf dev` rejects `--port` and `--host` for Vite projects, including the `cf init` template可能已有人在做 @jamesopstad 于 24 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
cloudflare/cf#223 · 已指派 2 人 ·
维护者通常 1 天内回复
-
upstream
难度 2/5 1-3 小时 新手友好度 75/100
cloudflare/cf#179 ·
维护者通常 1 天内回复
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
Yeraze/meshmonitor#6239 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
better-auth/better-auth#12292 · 1 个 reaction ·
维护者通常 1 天内回复
-
The sample email preview's ResizeObserver is never disconnected and keeps raising errors after leaving Settings可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭bug
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
area:ui bug effort:S priority:P2
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
Typo in WSL project description on Projects page可能已有人在做 @akhil9tiet 今天认领。 未关闭
难度 1/5 1 小时以内 新手友好度 75/100
microsoft/opensource.microsoft.com#1066 · 1 条评论 ·