Two Dev.to write-ups discuss how pnpm workspaces setups for TypeScript monorepos can work locally yet fail in CI when deploying to Railway. While pnpm’s official workspace documentation covers core mechanics—using a root pnpm-workspace.yaml to define packages, using workspace:* for internal dependencies, and running pnpm install from the repository root—the posts argue that several practical CI-specific traps are underemphasized.

The authors describe “phantom dependencies” as a key issue: pnpm enforces that packages can only import dependencies they explicitly declare, whereas other package managers’ flatter node_modules structures can hide undeclared imports locally. In fresh CI environments without cached pnpm stores, these missing declarations surface as module resolution errors.

They also focus on hoisting configuration. They say shamefully-hoist=true may not reliably apply on Railway when builds/install steps run from subdirectories rather than the monorepo root, and they recommend more targeted hoist-pattern[] usage or ensuring installs occur from the root.

Finally, they explain that pnpm --filter commands can mislead regarding build sequencing: --filter=<pkg> may not build internal dependencies first, while using --filter=<pkg>... and avoiding --parallel for build helps preserve dependency graph order. Both posts include a troubleshooting checklist and advise using --frozen-lockfile in CI.