Skip to content

Docusaurus fails to build with node v23 #10684

@torchsec-roni

Description

@torchsec-roni

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

Following the guide at https://docusaurus.io/docs/installation fails with node23.

Reproducible demo

No response

Steps to reproduce

➜  /tmp npx create-docusaurus@latest my-website classic
(node:15306) ExperimentalWarning: CommonJS module /opt/homebrew/lib/node_modules/npm/node_modules/debug/src/node.js is loading ES Module /opt/homebrew/lib/node_modules/npm/node_modules/supports-color/index.js using require().
Support for loading ES Module in require() is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
Need to install the following packages:
[email protected]
Ok to proceed? (y) 

✔ Which language do you want to use? › JavaScript
[INFO] Creating new Docusaurus project...
[INFO] Installing dependencies with npm...
(node:15620) ExperimentalWarning: CommonJS module /opt/homebrew/lib/node_modules/npm/node_modules/debug/src/node.js is loading ES Module /opt/homebrew/lib/node_modules/npm/node_modules/supports-color/index.js using require().
Support for loading ES Module in require() is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported

added 1216 packages, and audited 1217 packages in 33s

310 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
[SUCCESS] Created my-website.
[INFO] Inside that directory, you can run several commands:

  `npm start`
    Starts the development server.

  `npm run build`
    Bundles your website into static files for production.

  `npm run serve`
    Serves the built website locally.

  `npm run deploy`
    Publishes the website to GitHub pages.

We recommend that you begin by typing:

  `cd my-website`
  `npm start`

Happy building awesome websites!

➜  /tmp cd my-website 
➜  my-website npm run build

> [email protected] build
> docusaurus build

[INFO] [en] Creating an optimized production build...

● Client █████████████████████████ building (13%) 0/1 entries 1714/1715 dependencies 289/546 modules 257 active 
 css-loader › postcss-loader › node_modules/@docusaurus/theme-classic/lib/theme/DocSidebarItem/Html/styles.module.css

✖ Server
  Compiled with some errors in 4.20s


✖ Client
  Compiled with some errors in 6.22s

✖ Server
  

[ERROR] Client bundle compiled with errors therefore further build is impossible.
Unexpected end of JSON input

--------------------------

Unexpected end of JSON input

--------------------------

Unexpected end of JSON input

--------------------------

Unexpected end of JSON input

--------------------------

Unexpected end of JSON input
➜  my-website node --version
v23.2.0

Expected behavior

Project builds successfully

Actual behavior

Project fails to build with the following error:

[ERROR] Client bundle compiled with errors therefore further build is impossible.
Unexpected end of JSON input

--------------------------

Unexpected end of JSON input

--------------------------

Unexpected end of JSON input

--------------------------

Unexpected end of JSON input

--------------------------

Unexpected end of JSON input

Your environment

  • Public source code:
  • Public site URL:
  • Docusaurus version used: [email protected]
  • Environment name and version (e.g. Chrome 89, Node.js 16.4): Node.js v23.2.0
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS): Mac Sequoia 15.1

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