-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Closed
Description
I'm using React Router as a...
framework
Reproduction
Not provided unfortunately
System Info
Fly.io/github actionsUsed Package Manager
pnpm
Expected Behavior
Works without crashing
Actual Behavior
So we have a super frustrating issue on our website that has been happening since v2.15 of remix and now since v7.0.0 release of react-router. After a few days/weeks/months on random machines we get the following error mesage:
Error: No `routeModule` available to create server routes
invariant2(react-router.dist.development:chunk-D52XG6IA)
which crashes our website and results in an unhandled "Unexpected server error" shown. This happens because the error happens inside of react-router itself:

Here is the stack trace from sentry:
# syntax = docker/dockerfile:1.4
# Adjust NODE_VERSION as desired
ARG NODE_VERSION=20
FROM node:${NODE_VERSION}-slim as base
# Remix/Prisma app lives here
WORKDIR /app
# Throw-away build stage to reduce size of final image
FROM base as build
ARG PNPM_VERSION=9.7.0
RUN npm install -g pnpm@$PNPM_VERSION
# Install packages needed to build node modules
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y \
build-essential \
node-gyp \
openssl \
pkg-config \
python-is-python3 \
ca-certificates \
fuse3 \
sqlite3 \
curl && \
rm -rf /var/lib/apt/lists /var/cache/apt/archives
# Install node modules
COPY --link pnpm-lock.yaml package.json ./
RUN pnpm install --prefer-offline --prod=false
# Generate Prisma Client
COPY --link prisma .
RUN pnpm run prisma:generate
# Copy application code
COPY --link . .
# Set production environment
ENV NODE_ENV="production"
RUN pnpm run build
# Remove development dependencies
RUN pnpm prune --prod
FROM build as runner
# Copy built application
COPY --from=build /app /app
EXPOSE ${PORT}
CMD ["pnpm", "run", "start"]
We are not sure why this would happen and we've also noticed that the stack trace includes the development distribution of react-router, I'm guessing this could be the cause of it?
If you need additional info let me know
donaldaverill and crutchcorn
