Skip to content
Launchr Space Journal

Engineering Analysis · Global

One pnpm lockfile for Mac development and Linux deployments

pnpm 12.26 separates the platforms a shared lockfile covers from the native dependencies each machine downloads.

By Launchr Space ·

The lockfile covers macOS arm64 and Linux x64. The Mac install fetches optional native dependencies for macOS arm64 only.
With fetch set to current on a Mac, the same lockfile still covers the Linux deployment target.

An image resize that passes on an Apple silicon laptop can fail in a Linux container with the same package versions. Sharp ships platform-specific native builds, including builds for Linux x64 with either glibc or musl. A shared pnpm lockfile can cover the optional dependencies each environment needs while each machine downloads a smaller set.

pnpm 12.26.0, released December 2, splits that choice inside supportedArchitectures. The resolve list defines which platforms the lockfile covers. The fetch list selects which platform-specific optional dependencies pnpm installs locally. Changes limited to fetch work with a frozen lockfile, so teams can tune local downloads without rewriting their shared dependency record.

List the platforms that run the code

For Apple silicon laptops and glibc-based Linux x64 containers, put darwin-arm64 and linux-x64 in resolve in pnpm-workspace.yaml. Set fetch to current for ordinary installs. Add linux-x64-musl if you also deploy to an x64 Alpine image. Include every developer and CI platform that runs a normal install, since an explicit resolve list must cover the host when fetch selects current.

Pin the pnpm version across developer machines and CI. When you add a platform, regenerate the lockfile and review the changes before freezing it again. Use the OS, CPU architecture and C library from your final runtime image. For packages that build a native addon during installation, run that step on the target platform or in a compatible build environment.

Exercise the native operation in the built image

Start with a clean, frozen install on each production target. Then run a feature that actually loads the native dependency. For an image upload service, send a small test image to the built container and check the resized output dimensions. A startup probe can pass before the first request reaches Sharp.

Tie that test to the image you plan to release. If you ship both glibc and musl variants, capture the result for each. When you add a deployment target, extend the lockfile coverage and the release test in the same change.

Sources

For the final check against the deployed image, see the guide to smoke testing a critical production journey.

Keep reading