Remove explicit npm@11 upgrade from Dockerfiles#34
Merged
Conversation
Agent-Logs-Url: https://github.com/asepindrak/commitflow/sessions/611ef1bb-494b-44af-9e7c-bb46ffe011e5 Co-authored-by: asepindrak <13974298+asepindrak@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Remove npm v11 upgrade from Dockerfile
Remove explicit npm@11 upgrade from Dockerfiles
Apr 2, 2026
There was a problem hiding this comment.
Pull request overview
Removes the explicit global upgrade to npm@11 from the backend and frontend Docker build base stages to avoid the MODULE_NOT_FOUND: promise-retry failure during npm self-upgrade, relying instead on the npm version bundled with the Node base images.
Changes:
- Removed
RUN npm install -g npm@11frombackend/Dockerfilebase stage. - Removed
RUN npm install -g npm@11fromfrontend/Dockerfilebase stage.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| backend/Dockerfile | Drops npm v11 self-upgrade step to prevent Docker build failure in the base stage. |
| frontend/Dockerfile | Drops npm v11 self-upgrade step to prevent Docker build failure in the base stage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RUN npm install -g npm@11fails withMODULE_NOT_FOUND: promise-retryduring npm's self-upgrade — an internal dependency issue with npm v11 bootstrapping itself from the base image's npm.Changes
backend/Dockerfile: RemoveRUN npm install -g npm@11from thebasestagefrontend/Dockerfile: RemoveRUN npm install -g npm@11from thebasestageBoth
node:22-slimandnode:20-alpinealready ship with a modern npm (v10.x) sufficient for all install and build steps.Original prompt
Problem
Docker build fails on the
RUN npm install -g npm@11command with the following error:The error occurs during the npm self-upgrade step in the Dockerfile base stage (line 21).
Root Cause
npm v11 installation is missing internal dependencies (like
promise-retry) required for the upgrade process. This is likely due to compatibility issues with npm v11 in the current node:22-slim Docker image.Solution
Remove the explicit npm v11 upgrade. The node:22-slim base image already includes a modern, stable version of npm that's suitable for the build process. Removing this step:
Changes
RUN npm install -g npm@11The following is the prior conversation context from the user's chat exploration (may be truncated):
User: ada error ketika build di server
#10 [base 4/6] RUN npm install -g npm@11
#10 156.2 npm error code MODULE_NOT_FOUND
#10 156.2 npm error Cannot find module 'promise-retry'
#10 156.2 npm error Require stack:
#10 156.2 npm error - /usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js
#10 156.2 npm error - /usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/index.js
#10 156.2 npm error - /usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/index.js
#10 156.2 npm error - /usr/local/lib/node_modules/npm/node_modules/libnpmfund/lib/index.js
#10 156.2 npm error - /usr/local/lib/node_modules/npm/lib/utils/reify-output.js
#10 156.2 npm error - /usr/local/lib/node_modules/npm/lib/utils/reify-finish.js
#10 156.2 npm error - /usr/local/lib/node_modules/npm/lib/commands/install.js
#10 156.2 npm error - /usr/local/lib/node_modules/npm/lib/npm.js
#10 156.2 npm error - /usr/local/lib/node_modules/npm/lib/cli/entry.js
#10 156.2 npm error - /usr/local/lib/node_modules/npm/lib/cli.js
#10 156.2 npm error - /usr/local/lib/node_modules/npm/bin/npm-cli.js
#10 156.2 npm error A complete log of this run can be found in: /root/.npm/_logs/2026-04-02T16_52_30_788Z-debug-0.log
#10 ERROR: process "/bin/sh -c npm install -g npm@11" did not complete successfully: exit code: 1
Dockerfile:21
|
| # Update npm versi terbaru
| >>> RUN npm install -g npm@11
|
| # Salin dependency info lebih dulu
ERROR: failed to build: failed to solve: process "/bin/sh -c npm install -g npm@11" did not complete successfully: exit code: 1
❌ Docker build failed
Error occurred ❌, check the logs for details.
Assistant: I'll look at your Dockerfile to understand the build issue.
Assistant: Masalahnya ada pada baris 21:
RUN npm install -g npm@11Error menunjukkan bahwa npm versi 11 yang sedang diinstall tidak bisa menemukan module
promise-retry. Ini adalah masalah kompatibilitas atau dependency yang hilang saat npm sedang self-upgrading.Solusi yang Disarankan:
Opsi 1: Hapus/Skip npm upgrade (Paling aman)
Opsi 2: Upgrade npm dengan cara yang lebih aman
RUN npm install -g npm@latest --no-saveatau
RUN npm install -g npm@10Opsi 3: Perbaiki npm upgrade dengan dependency yang tepat
RUN npm install -g npm@11 --forcePenyebab Utama:
Ketika npm sedang upgrade ke versi 11, ada dependency internal yang hilang (
promise-retry). Ini bisa terjadi karena:Apa yang ingin kamu lakukan?
Apakah kamu ingin aku buat PR untuk memperbaiki Dockerfile?
User: boleh buatkan aja langsung PR nya
...
This pull request was created from Copilot chat.