Skip to content

pnpm 12 builds fail: error: unexpected value 'false' for '--prod' found #273

Description

@thibaultleouay

lib/package_managers/pnpm.sh (package_managers::pnpm::install_dependencies) always installs with:

pnpm_install_args=("install" "--prod=false" "--frozen-lockfile")

pnpm 12 (the new Rust/pacquet CLI) declares --prod as a bare boolean flag and no longer accepts a value, so the very first install step fails before anything runs:

Running 'pnpm install' with pnpm-lock.yaml
error: unexpected value 'false' for '--prod' found; no more were expected

Usage: pnpm install --prod

This is the same flag-compat issue tracked in pnpm/pnpm#14281, and it's why Railway already dropped --prod=false (railwayapp/railpack commit 373541d).

Suggested fix: pnpm >=10 ignores NODE_ENV and installs dev + prod deps by default, so --prod=false is a no-op there. Branch on the pnpm major (as the buildpack already does for the store-dir env var) and omit the flag for pnpm >=10:

if (( pnpm_major < 10 )); then
  pnpm_install_args=("install" "--prod=false" "--frozen-lockfile")
else
  pnpm_install_args=("install" "--frozen-lockfile")
fi

Repro verified locally: pnpm@12.3.4 install --prod=false exits 2 with that exact message; pnpm@11.26.0 accepts it.

Activity

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