Skip to content

Projects created with init -p pnpm don't install or run correctly #654

Open

Description

@ElliotFriend

stellar scaffold init -p pnpm records pnpm in scaffold.yml and writes pnpm-workspace.yaml, but otherwise leaves the template's npm-specific setup in place. The resulting project fails to install, and its scripts still run npm.

Environment

  • stellar-scaffold v0.0.34
  • Node v24.11.0
  • official Svelte template
  • Tested with pnpm v11.28.2; build-script behavior also checked on pnpm v10.34.9 and v12.16.1.

Reproduce

stellar scaffold init my-app --template svelte -p pnpm
cd my-app && pnpm install

Problems

  1. Install fails. app/package.json depends on "@stellar-scaffold/app-lib": "*". npm links that to the workspace package, but pnpm doesn't link workspace packages by default, so it looks for the package on the npm registry and throws an error something like:

    ERR_PNPM_FETCH_404 ... @stellar-scaffold/app-lib is not in the npm registry
    

    init's own install step hits this, but run_install only warns on it, so init still reports success. pnpm needs workspace:* here, and npm rejects that protocol, so the template can't use one spec for both.

  2. Scripts are npm-only. pnpm has no --workspace / --workspaces flags. Replacing the word npm with pnpm makes start call itself in a loop, because pnpm forwards the extra arguments to the root script.

    Script Template pnpm equivalent
    root start npm start --workspace app pnpm --filter ./app start
    root lint npm run lint --workspaces --if-present pnpm -r --if-present lint
    root dev npm start pnpm start
    app dev npm start pnpm start
  3. Dependency build scripts block every command on pnpm 11+. pnpm blocks dependency build scripts by default. On pnpm 10 that produces a warning, but pnpm 11/12, install fails with ERR_PNPM_IGNORED_BUILDS until each package is approved or denied. The template needs those build script entries for @reown/appkit, bufferutil, secp256k1, unrs-resolver, and utf-8-validate. All five work with false, in my own testing: most of them even ship prebuilt binaries and/or have JS fallbacks.

  4. Leftover npm config. The root workspaces field is left in place in package.json (pnpm ignores it and needs it in pnpm-workspace.yaml instead). Also, no packageManager field is written to package.json, which might be a nice touch. (Though, i do see some comments in crates/stellar-scaffold-cli/src/commands/mod.rs indicating the absence from package.json is maybe intentional.)

Proposal

I'm thinking we could leave the template(s) as they are, and make the init command do whatever conversions/fixes/find-n-replaces necessary. apply_package_manager in init/instantiate.rs already handles pnpm partially (it writes pnpm-workspace.yaml and removes package-lock.json). Extending that function so the instantiated project is fully converted would cover everything above:

  • app/package.json: rewrite @stellar-scaffold/app-lib to workspace:*
  • Root and app/package.json scripts: replace npm invocations with their pnpm equivalents (table above)
  • Root package.json: remove workspaces, add packageManager (again, if it's not intentionally kept out of here)
  • pnpm-workspace.yaml: add build-script entries for the recorded pnpm version (allowBuilds on pnpm 11+, ignoredBuiltDependencies on pnpm 10)

One way to accomplish this might be to follow the existing pattern of rewrite_root_workspaces, which loads the root package.json with serde_json, edits it, and writes it back. A similar helper function could apply a pnpm-specific transform to each instantiated manifest file: rewrite workspace dependency specs, and map script commands through a small npm-to-pnpm lookup. Since only official templates go through apply_package_manager, the lookup can match the known template scripts exactly. Unrecognized scripts would be left alone, rather than guessed at.

Yarn, Bun, and Deno would likely need similar handling. But, I'm less familiar with those, and have only tested with pnpm myself. I'd start there and structure the helper so other managers can be added more easily. I'm happy to take a stab at a first-draft run of a fix, if it would help.

Related

Activity

  1. zachfedor commented on Nov 3, 2026

    @zachfedor
    Contributor

    Adding #658 to the list of pnpm fixes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions