[ Solved ] Deployment error: "failed to fetch an image or build from source"

Hello guys, I’m not able to deploy lately, and I’m not sure if it’s because the V2 of the Fly Apps platform, or maybe missing something.

I’m usually able to deploy, not this time. Here’s the error that throws at me at deploy time:

Error failed to fetch an image or build from source: error building: cannot replace to directory /data/docker/overlay2/ohsgpwqx56hus9ybun38nxad2/merged/myapp/node_modules/@babel/eslint-parser with file

And here’s the full log:

flyctl deploy
Update available 0.0.500 -> 0.0.509.
Run "flyctl version update" to upgrade.
==> Verifying app config
--> Verified app config
==> Building image
Remote builder fly-builder-falling-sun-6283 ready
==> Creating build context
--> Creating build context done
==> Building image with Docker
--> docker host: 20.10.12 linux x86_64
[+] Building 223.6s (0/1)
[+] Building 227.9s (15/22)
 => [internal] load remote build context                                                                  0.0s
 => copy /context /                                                                                       6.6s
 => [internal] load metadata for docker.io/library/node:16-bullseye-slim                                  0.8s
 => [base 1/2] FROM docker.io/library/node:16-bullseye-slim@sha256:06135c43667a4be30a8102171a9afd7d90e6e  3.7s
 => => resolve docker.io/library/node:16-bullseye-slim@sha256:06135c43667a4be30a8102171a9afd7d90e6eada73  0.0s
 => => sha256:6cce1c7f7a2a9781ad8c1efab16a38df646d66b799322eb7a94478bcdb6a59ec 35.27MB / 35.27MB          0.4s
 => => sha256:9731b2a8ac30b56b7db6c8b282df734f7924ab88efffdccd3d3e250fb831831e 2.76MB / 2.76MB            0.1s
 => => sha256:666ffabcb5e942856c52ca0e55f92eb910f3d55d46771bd6472104f11973330d 451B / 451B                0.1s
 => => sha256:06135c43667a4be30a8102171a9afd7d90e6eada7318ae23bd05295cd4eda543 1.21kB / 1.21kB            0.0s
 => => sha256:0b889cbf70af3740c8caaee425be6a26f2e7f3ceffdb94a83b6d236eea1b421e 1.37kB / 1.37kB            0.0s
 => => sha256:b5e4b460622cf2d71cc7fc5231c0d522c61e1013828226c400e5e9415bf8de83 6.84kB / 6.84kB            0.0s
 => => sha256:f1f26f5702560b7e591bef5c4d840f76a232bf13fd5aefc4e22077a1ae4440c7 31.41MB / 31.41MB          1.6s
 => => sha256:4fc84cbecc3869af9f699f16afadf5d47423a7360e22a607aa9228a7d9e3d192 4.18kB / 4.18kB            0.0s
 => => extracting sha256:f1f26f5702560b7e591bef5c4d840f76a232bf13fd5aefc4e22077a1ae4440c7                 0.9s
 => => extracting sha256:4fc84cbecc3869af9f699f16afadf5d47423a7360e22a607aa9228a7d9e3d192                 0.0s
 => => extracting sha256:6cce1c7f7a2a9781ad8c1efab16a38df646d66b799322eb7a94478bcdb6a59ec                 0.9s
 => => extracting sha256:9731b2a8ac30b56b7db6c8b282df734f7924ab88efffdccd3d3e250fb831831e                 0.1s
 => => extracting sha256:666ffabcb5e942856c52ca0e55f92eb910f3d55d46771bd6472104f11973330d                 0.0s
 => [base 2/2] RUN apt-get update && apt-get install -y sqlite3                                           5.7s
 => [build 1/6] WORKDIR /myapp                                                                            0.0s
 => [deps 2/3] ADD package.json ./                                                                        0.0s
 => [deps 3/3] RUN npm install --production=false                                                       191.5s
 => [build 2/6] COPY --from=deps /myapp/node_modules /myapp/node_modules                                  4.7s
 => [build 3/6] ADD prisma .                                                                              0.0s
 => [production-deps 3/4] ADD package.json ./                                                             0.0s
 => [production-deps 4/4] RUN npm prune --production                                                      6.7s
 => [build 4/6] RUN npx prisma generate                                                                   3.1s
 => ERROR [build 5/6] ADD . .                                                                             7.3s
 => CANCELED [stage-4 2/8] COPY --from=production-deps /myapp/node_modules /myapp/node_modules            1.1s
------
 > [build 5/6] ADD . .:
------
Error failed to fetch an image or build from source: error building: cannot replace to directory /data/docker/overlay2/ohsgpwqx56hus9ybun38nxad2/merged/myapp/node_modules/@babel/eslint-parser with file

Leaving here the Dockerfile File also.

Seems to be an eslint-parser error at COPY time from the node_modules, at least it’s what I can understand.

Anyone has a clue about what could be going on? Used to work before. Thank you!

Maybe you need to exclude the local node_modules directory from the Docker build?
node.js - cannot replace to directory /var/lib/docker/overlay2/if2ip5okvavl8u6jpdtpczuog/merged/app/node_modules/@ampproject/remapping with file - Stack Overflow

1 Like

Thanks tom, forgot to add a .dockeringore to my app. My bad!
Thank you so much for the ansnwer!

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.