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

Abierto
#511 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
55/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
typescript
Área
build-system, cli

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.
Lenguaje dominante
TypeScript
Estrellas
993
Forks
65
Merge medio
21 h 40 min
PR fusionados (30 d)
211

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de cloudflare/cf

Todos los issues de cloudflare/cf

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.