#Dockerfile - "ERROR Cannot start nuxt: Could not load @nuxt/fonts. Is it installed?"
3 messages · Page 1 of 1 (latest)
The error "Could not load @nuxt/fonts. Is it installed?" when starting your Nuxt app in Docker usually means that the @nuxt/fonts module is either not installed or not present in the final production image.
Based on your Dockerfile, the likely issue is that you are only copying the .output directory from the build stage to the prod stage:
COPY --from=build /app/.output ./
However, Nuxt modules (like @nuxt/fonts) are installed in node_modules, which is not included in .output. The @nuxt/fonts module is required at runtime, so node_modules must be present in your production image.
How to fix:
You should copy node_modules from the deps or build stage into your prod stage as well. For example:
FROM node:22-alpine AS prod
WORKDIR /app
ENV NODE_ENV=production
ENV PORT=80
COPY --from=build /app/.output ./
COPY --from=deps /app/node_modules ./node_modules
EXPOSE 80
CMD ["node", "server/index.mjs"]
This ensures that all runtime dependencies, including @nuxt/fonts, are available when your app starts.
Additional notes:
- Nuxt UI and Nuxt UI Pro automatically register @nuxt/fonts for you, so you don't need to install it manually unless you disabled it in your config or removed it from your dependencies. If you do need to install it, you can run
npm i @nuxt/fontsand add it to your modules innuxt.config.tsas shown in the Nuxt Fonts installation guide. - If you use a .dockerignore file, make sure it does not exclude node_modules during the dependency install and build stages, but you can safely ignore it for the context sent to Docker.
Summary:
Copy node_modules into your production image to resolve the error. This is a common requirement for Nuxt modules that are needed at runtime, such as @nuxt/fonts.
References: