---
title: "Comment by Node Edge Ops on \"NestJS Deployment on pnpm 11: Fixing Native Binaries Like bcrypt in Docker\n\" | Hashnode"
description: "For a Nest image that needs native modules such as bcrypt under pnpm 11, keep a multi-stage build: install with the approved build scripts enabled only in the b"
url: "https://hashnode.com/posts/nestjs-deployment-on-pnpm-11-fixing-native-binaries-like-bcrypt-in-docker/6a272a4b11ee3d024249941c/comment/6aec15164392c688c0309b3d"
---

[Discussion](https://hashnode.com/posts/nestjs-deployment-on-pnpm-11-fixing-native-binaries-like-bcrypt-in-docker/6a272a4b11ee3d024249941c)

Comment [NestJS Deployment on pnpm 11: Fixing Native Binaries Like bcrypt in Docker](https://hashnode.com/posts/nestjs-deployment-on-pnpm-11-fixing-native-binaries-like-bcrypt-in-docker/6a272a4b11ee3d024249941c)

[Node Edge Ops](https://hashnode.com/@nodeedgeops)

[Nov 5](https://hashnode.com/posts/nestjs-deployment-on-pnpm-11-fixing-native-binaries-like-bcrypt-in-docker/6a272a4b11ee3d024249941c/comment/6aec15164392c688c0309b3d)

For a Nest image that needs native modules such as bcrypt under pnpm 11, keep a multi-stage build: install with the approved build scripts enabled only in the builder, copy the compiled node\_modules and dist into a slim runtime image, and never ship the toolchain into production. Nest should listen on a private port or Compose network only; put a reverse proxy on 80/443 in front, resolve the Nest service by internal name, and pin proxy\_http\_version 1.1 with Connection cleared so keepalive into Node reuses sockets. Always forward Host, X-Forwarded-For, and X-Forwarded-Proto so Nest builds redirects, cookies, and absolute URLs against the public scheme. Fail the image build if the native .node binary is missing for the runtime libc, rather than discovering ERR\_DLOPEN at boot behind the proxy.

Ops check after a rebuild or rolling restart: confirm the bcrypt binding loads inside the runtime container, hit a cheap readiness path that exercises Nest plus a crypto round-trip from the proxy container on the internal network, then the same path through published 443, and compare status and timing. A short 502 window usually means the edge still talked to a draining worker; tighten max\_fails / fail\_timeout so a half-dead process leaves the pool quickly, and log upstream status beside request time to separate a missing native addon crash from TLS or vhost drift. Prefer one upstream to the Nest listen port and let the orchestrator own fan-out rather than listing every replica by hand in the proxy.
