Rails app - problem with node_modules when deploying

I am trying to deploy a Rails app and in the final stages of the build of the image it fails with

 > [stage-4 5/8] COPY --from=node_modules /app/node_modules /app/node_modules:
Error failed to fetch an image or build from source: error building: failed to compute cache key: "/app/node_modules" not found: not found

What can I do? Thanks

Hi @vitobotta

Have you tried building the docker image locally to test it?

It looks like the docker image builder can’t find the folder specified.

In a preceding build step, yarn build failed to create a node-modules directory, causing a later step to fail when it tries to copy the results of the previous step. Were there errors earlier in this build?