Railpack's pnpm detection always uses  --frozen-lockfile
fengning-starsend
HOBBYOP

3 months ago

Railpack's pnpm detection always uses  --frozen-lockfile, which cannot be overridden. This breaks deployments for pnpm monorepos where the service's Root Directory differs from the lockfile location.

Environment:

  • Railpack 0.15.3

  • pnpm 10.17.0

  • Monorepo with Root Directory = 

    frontend/

     and 

    pnpm-lock.yaml at repo root

Problem: When Railway's Root Directory is set to a subdirectory (e.g., 

frontend/

), Railpack copies both the subdirectory's package.json and the root pnpm-lock.yaml, then runs:

pnpm install --frozen-lockfile --prefer-offline

This fails with 

ERR_PNPM_OUTDATED_LOCKFILE

 because pnpm interprets the workspace lockfile differently when run from a subdirectory context.

What We Tried (all failed with Railpack):

  1. Creating 

    frontend/.npmrc with 

    frozen-lockfile=false

     - CLI args override config files

  2. Using 

    installCommand

     in 

    railway.toml - Railpack ignores this setting

  3. Regenerating the lockfile multiple ways - Railpack's caching causes stale package.json to be used

Workaround: We had to switch to NIXPACKS with a custom install command:

toml

# frontend/nixpacks.toml

[phases.install]

cmds = ["pnpm install --no-frozen-lockfile"]

Feature Request: Add a config option to Railpack to disable 

--frozen-lockfile

, such as:

  • Environment variable: 

    RAILPACK_PNPM_NO_FROZEN_LOCKFILE=true
  • Or config in 

    railway.toml

    frozenLockfile = false
Solved$10 Bounty

Pinned Solution

domehane
FREE

3 months ago

set this environment variable in your service settings:

RAILPACK_INSTALL_CMD=pnpm install --no-frozen-lockfile

it will override the default frozen lockfile flag

4 Replies

domehane
FREE

3 months ago

set this environment variable in your service settings:

RAILPACK_INSTALL_CMD=pnpm install --no-frozen-lockfile

it will override the default frozen lockfile flag


3 months ago

Thanks for outlining the issue. We should improve how this is handled on railpack to detect this case. Added this to the railpack TODO!


domehane
FREE

3 months ago

@fengning-starsend did the cmd works for you now ?


fengning-starsend
HOBBYOP

3 months ago

yes it works, thank you!


Status changed to Solved brody 3 months ago


Loading...