Skip to content

Docusaurus fails to build in docker (Module not found: Can't resolve ...) #10683

@Gijsdeman

Description

@Gijsdeman

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

With the latest version of Docusaurus, builds seem to fail inside Docker containers due to resolve issues. This is an issue with @docusaurus/faster when enabling rspackBundler in the experimental_faster. This introduces the dependency on @rspack/[email protected], which currently fails to resolve node_modules in Docker containers.

Docusaurus uses @rspack/core@^1.0.14, however, this resolves @rspack/[email protected] rather than @rspack/bindings@@1.0.14.

This issue is more meant for people currently experiencing this behavour. To fix it, at least for yarn, add the following to package.json:

"resolutions": {
    "@rspack/core": "1.0.14",
    "@rspack/binding": "1.0.14"
},

Reproducible demo

No response

Steps to reproduce

  1. npx create-docusaurus@latest my-website classic --typescript
  2. cd my-website
  3. yarn add @docusaurus/faster
  4. Add future: { experimental: true }, to the docusaurus.config.ts
  5. docker run --rm -it -v .:/my-website node:18.20-alpine sh
  6. cd my-website
  7. yarn build

Expected behavior

For the Docusaurus website to build without any issues.

Actual behavior

The following error is shown

[ERROR] Client bundle compiled with errors therefore further build is impossible.
× Module not found: Can't resolve '/my-website/node_modules/@docusaurus/core/lib/client/clientEntry.js' in '/my-website'

Your environment

  • Docusaurus version used: 3.6.1
  • Environment name and version (e.g. Chrome 89, Node.js 16.4): docker image node:18.20-alpine, but persists accross multiple images
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS): Ubuntu 20.04 LTS

Self-service

  • I'd be willing to fix this bug myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn error in the Docusaurus core causing instability or issues with its executionexternalThis issue is caused by an external dependency and not Docusaurus.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions