Module "express" not found when trying to deploy Express application

I’m not (yet!) familiar enough with pnpm’s inner workings, but I suspect that there is a full path someplace internally when dealing with monoreps.

It looks like you are only deploying one app. If so, perhaps instead of:

COPY --link . .
RUN pnpm i --filter api
...
COPY --from=build /app/apps/server/api /app

You could try:

COPY --link apps/server/api .
RUN pnpm i
...
COPY --from=build /app /app

Another approach is to copy the whole tree and then change the workdir. So replace:

COPY --from=build /app/apps/server/api /app

with

COPY --from=build /app /app
WORKDIR /app/apps/server/api
1 Like