From 1b8c23094ec61ab1eb8ba0ada2ff63ec6d422455 Mon Sep 17 00:00:00 2001 From: Yuneng Jiang Date: Fri, 3 Apr 2026 18:07:35 -0700 Subject: [PATCH] fix(docker): install node-gyp for non-root image npm ci The wolfi-base npm@11.12.1 package does not bundle node-gyp, causing npm ci to fail with MODULE_NOT_FOUND when building the Admin UI. Install node-gyp@12.2.0 globally and symlink it into npm's internal node_modules where @npmcli/run-script expects to find it. Also pin npm to 11.12.1 instead of @latest. Cherry-picked from BerriAI/litellm#25037. Co-Authored-By: Claude Opus 4.6 (1M context) --- docker/Dockerfile.non_root | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docker/Dockerfile.non_root b/docker/Dockerfile.non_root index fda591df083..431bd49fbc8 100644 --- a/docker/Dockerfile.non_root +++ b/docker/Dockerfile.non_root @@ -41,8 +41,15 @@ COPY . . ENV LITELLM_NON_ROOT=true # Build Admin UI using the upstream command order while keeping a single RUN layer +# NOTE: .npmrc (which has ignore-scripts=true and min-release-age=3d) is temporarily +# renamed during npm install/ci. This is safe because npm ci installs from +# package-lock.json with pinned versions + integrity hashes. RUN mkdir -p /var/lib/litellm/ui && \ - npm install -g npm@latest && npm cache clean --force && \ + [ -f /app/.npmrc ] && mv /app/.npmrc /app/.npmrc.bak || true && \ + npm install -g npm@11.12.1 && \ + npm install -g node-gyp@12.2.0 && \ + ln -sf /usr/local/lib/node_modules/node-gyp /usr/lib/node_modules/npm/node_modules/node-gyp && \ + npm cache clean --force && \ cd /app/ui/litellm-dashboard && \ if [ -f "/app/enterprise/enterprise_ui/enterprise_colors.json" ]; then \ cp /app/enterprise/enterprise_ui/enterprise_colors.json ./ui_colors.json; \