[GH-ISSUE #199] Unable to build backend with Dockerfile #59

Open
opened 2026-02-27 04:58:58 +03:00 by kerem · 3 comments
Owner

Originally created by @olepl on GitHub (Nov 11, 2024).
Original GitHub issue: https://github.com/guyzyl/whatsapp-contact-sync/issues/199

When I try to build the Docker image of either the complete app or just the backend I get the following error:

> [server-build 10/10] RUN mv node_modules/googleapis/build/src/apis/docs ./docs &&     node-prune --exclude "**/googleapis/**/docs/*.js" &&     mv ./docs node_modules/googleapis/build/src/apis/docs:
0.176 /bin/sh: node-prune: not found
------
Dockerfile:38
--------------------
 37 |     # The mv is a workaround for this - https://github.com/tj/node-prune/issues/63
 38 | >>> RUN mv node_modules/googleapis/build/src/apis/docs ./docs && \
 39 | >>>     node-prune --exclude "**/googleapis/**/docs/*.js" && \
 40 | >>>     mv ./docs node_modules/googleapis/build/src/apis/docs
 41 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c mv node_modules/googleapis/build/src/apis/docs ./docs &&     node-prune --exclude \"**/googleapis/**/docs/*.js\" &&     mv ./docs node_modules/googleapis/build/src/apis/docs" did not complete successfully: exit code: 127

If I simply comment out the highlighted lines (38-40) I can build the image successfully

Originally created by @olepl on GitHub (Nov 11, 2024). Original GitHub issue: https://github.com/guyzyl/whatsapp-contact-sync/issues/199 When I try to build the Docker image of either the complete app or just the backend I get the following error: ``` > [server-build 10/10] RUN mv node_modules/googleapis/build/src/apis/docs ./docs && node-prune --exclude "**/googleapis/**/docs/*.js" && mv ./docs node_modules/googleapis/build/src/apis/docs: 0.176 /bin/sh: node-prune: not found ------ Dockerfile:38 -------------------- 37 | # The mv is a workaround for this - https://github.com/tj/node-prune/issues/63 38 | >>> RUN mv node_modules/googleapis/build/src/apis/docs ./docs && \ 39 | >>> node-prune --exclude "**/googleapis/**/docs/*.js" && \ 40 | >>> mv ./docs node_modules/googleapis/build/src/apis/docs 41 | -------------------- ERROR: failed to solve: process "/bin/sh -c mv node_modules/googleapis/build/src/apis/docs ./docs && node-prune --exclude \"**/googleapis/**/docs/*.js\" && mv ./docs node_modules/googleapis/build/src/apis/docs" did not complete successfully: exit code: 127 ``` If I simply comment out the highlighted lines (38-40) I can build the image successfully
Author
Owner

@guyzyl commented on GitHub (Nov 28, 2024):

I just tried building the image myself and it worked for me.
Can you provide some more details? The full build log, OS + Docker version, and the command you ran to build the image?
(and sorry for the delay)

<!-- gh-comment-id:2506745334 --> @guyzyl commented on GitHub (Nov 28, 2024): I just tried building the image myself and it worked for me. Can you provide some more details? The full build log, OS + Docker version, and the command you ran to build the image? (and sorry for the delay)
Author
Owner

@olepl commented on GitHub (Nov 28, 2024):

Of course!

Docker: Docker version 27.3.1, build v27.3.1
OS: NixOS 25.05

FYI NixOS is a Linux distro where you declaratively define your packages and configuration. My config can be viewed here. The main difference compared to other Linux systems to be aware of is that NixOS doesn't conform to the FHS.

Command: docker build -t whasync . or docker build -t whasync-backend -f server/Dockerfile . as described in your README, both produce the following output with just the line numbers for the highlighted lines changed:

[+] Building 0.7s (14/28)                                                                      docker:default
 => [internal] load build definition from Dockerfile                                                     0.0s
 => => transferring dockerfile: 1.52kB                                                                   0.0s
 => [internal] load metadata for docker.io/library/node:21-alpine                                        0.4s
 => [internal] load .dockerignore                                                                        0.0s
 => => transferring context: 101B                                                                        0.0s
 => [internal] load build context                                                                        0.0s
 => => transferring context: 815.24kB                                                                    0.0s
 => [server-build  1/10] FROM docker.io/library/node:21-alpine@sha256:78c45726ea205bbe2f23889470f03b46a  0.0s
 => CACHED [server-build  2/10] WORKDIR /app/server                                                      0.0s
 => CACHED [server-build  3/10] COPY [server/package.json, server/package-lock.json*, ./]                0.0s
 => CACHED [server-build  4/10] RUN npm install                                                          0.0s
 => CACHED [server-build  5/10] COPY ./interfaces /app/interfaces                                        0.0s
 => CACHED [server-build  6/10] COPY ./server .                                                          0.0s
 => CACHED [server-build  7/10] RUN npm run build                                                        0.0s
 => CACHED [server-build  8/10] RUN npm prune --production                                               0.0s
 => CACHED [server-build  9/10] RUN apk update &&     apk add curl &&     curl -sf https://gobinaries.c  0.0s
 => ERROR [server-build 10/10] RUN mv node_modules/googleapis/build/src/apis/docs ./docs &&     node-pr  0.2s
------
 > [server-build 10/10] RUN mv node_modules/googleapis/build/src/apis/docs ./docs &&     node-prune --exclude "**/googleapis/**/docs/*.js" &&     mv ./docs node_modules/googleapis/build/src/apis/docs:
0.203 /bin/sh: node-prune: not found
------
Dockerfile:38
--------------------
  37 |     # The mv is a workaround for this - https://github.com/tj/node-prune/issues/63
  38 | >>> RUN mv node_modules/googleapis/build/src/apis/docs ./docs && \
  39 | >>>     node-prune --exclude "**/googleapis/**/docs/*.js" && \
  40 | >>>     mv ./docs node_modules/googleapis/build/src/apis/docs
  41 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c mv node_modules/googleapis/build/src/apis/docs ./docs &&     node-prune --exclude \"**/googleapis/**/docs/*.js\" &&     mv ./docs node_modules/googleapis/build/src/apis/docs" did not complete successfully: exit code: 127

Clearly those 3 lines are a problem for some reason, and as mentioned I can comment the lines out and build the image successfully.

What is the purpose of those lines, are you able build the image without those lines?

<!-- gh-comment-id:2506834843 --> @olepl commented on GitHub (Nov 28, 2024): Of course! Docker: Docker version 27.3.1, build v27.3.1 OS: NixOS 25.05 FYI NixOS is a Linux distro where you declaratively define your packages and configuration. My config can be viewed [here](https://gitlab.com/olepl/nix). The main difference compared to other Linux systems to be aware of is that NixOS doesn't conform to the [FHS](https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html). Command: `docker build -t whasync .` or `docker build -t whasync-backend -f server/Dockerfile .` as described in your README, both produce the following output with just the line numbers for the highlighted lines changed: ``` [+] Building 0.7s (14/28) docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 1.52kB 0.0s => [internal] load metadata for docker.io/library/node:21-alpine 0.4s => [internal] load .dockerignore 0.0s => => transferring context: 101B 0.0s => [internal] load build context 0.0s => => transferring context: 815.24kB 0.0s => [server-build 1/10] FROM docker.io/library/node:21-alpine@sha256:78c45726ea205bbe2f23889470f03b46a 0.0s => CACHED [server-build 2/10] WORKDIR /app/server 0.0s => CACHED [server-build 3/10] COPY [server/package.json, server/package-lock.json*, ./] 0.0s => CACHED [server-build 4/10] RUN npm install 0.0s => CACHED [server-build 5/10] COPY ./interfaces /app/interfaces 0.0s => CACHED [server-build 6/10] COPY ./server . 0.0s => CACHED [server-build 7/10] RUN npm run build 0.0s => CACHED [server-build 8/10] RUN npm prune --production 0.0s => CACHED [server-build 9/10] RUN apk update && apk add curl && curl -sf https://gobinaries.c 0.0s => ERROR [server-build 10/10] RUN mv node_modules/googleapis/build/src/apis/docs ./docs && node-pr 0.2s ------ > [server-build 10/10] RUN mv node_modules/googleapis/build/src/apis/docs ./docs && node-prune --exclude "**/googleapis/**/docs/*.js" && mv ./docs node_modules/googleapis/build/src/apis/docs: 0.203 /bin/sh: node-prune: not found ------ Dockerfile:38 -------------------- 37 | # The mv is a workaround for this - https://github.com/tj/node-prune/issues/63 38 | >>> RUN mv node_modules/googleapis/build/src/apis/docs ./docs && \ 39 | >>> node-prune --exclude "**/googleapis/**/docs/*.js" && \ 40 | >>> mv ./docs node_modules/googleapis/build/src/apis/docs 41 | -------------------- ERROR: failed to solve: process "/bin/sh -c mv node_modules/googleapis/build/src/apis/docs ./docs && node-prune --exclude \"**/googleapis/**/docs/*.js\" && mv ./docs node_modules/googleapis/build/src/apis/docs" did not complete successfully: exit code: 127 ``` Clearly those 3 lines are a problem for some reason, and as mentioned I can comment the lines out and build the image successfully. What is the purpose of those lines, are you able build the image without those lines?
Author
Owner

@guyzyl commented on GitHub (Dec 5, 2024):

With 0 knowledge (or testing) of Nix, from your statement it sounds like the lack of FHS is what's causing it.

And in regard to the 3 lines, the purpose is to cleanup packages from the Docker image.
You can remove them locally if you'd like and it should still work as intended.

<!-- gh-comment-id:2521340855 --> @guyzyl commented on GitHub (Dec 5, 2024): With 0 knowledge (or testing) of Nix, from your statement it sounds like the lack of FHS is what's causing it. And in regard to the 3 lines, the purpose is to cleanup packages from the Docker image. You can remove them locally if you'd like and it should still work as intended.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/whatsapp-contact-sync#59
No description provided.