Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docusaurus fails to build with node v23 #10684

Closed
5 of 7 tasks
torchsec-roni opened this issue Nov 15, 2024 · 5 comments
Closed
5 of 7 tasks

Docusaurus fails to build with node v23 #10684

torchsec-roni opened this issue Nov 15, 2024 · 5 comments
Labels
bug An error in the Docusaurus core causing instability or issues with its execution external This issue is caused by an external dependency and not Docusaurus.

Comments

@torchsec-roni
Copy link

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.
@torchsec-roni torchsec-roni added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Nov 15, 2024
@slorber
Copy link
Collaborator

slorber commented Nov 15, 2024

I'm running these exact commands using Node 23.2 on Sequoia 15.0.1 and can't reproduce 🤷‍♂️

Are you sure you obtained the error message this way?

Can you try on another non-tmp folder?

(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

This warning seems suspicious. Are you using a custom NODE_OPTIONS env variable with experimental options?

@torchsec-roni
Copy link
Author

torchsec-roni commented Nov 15, 2024

Thanks for the quick response Sébastien! This issue happens to me in ~ as well (attaching Terminal output below).

This warning is because Node.js 23 unflagged --experimental-require-module which causes the warning when ESM files are loaded.

It appears other popular open sources (like tailwind) are having issues w node23 as well: tailwindlabs/tailwindcss#14818.

~ node --version
v23.2.0
➜  ~ npx create-docusaurus@latest my-website classic
(node:38323) 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)
✔ Which language do you want to use? › JavaScript
[INFO] Creating new Docusaurus project...
[INFO] Installing dependencies with npm...
(node:38355) 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 41s

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!~ 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 1725/1725 dependencies 302/548 modules 245 active 
 css-loader › postcss-loader › node_modules/@docusaurus/theme-classic/lib/theme/DocSidebarItem/Link/styles.module.css

✖ Server
  Compiled with some errors in 4.14s


✖ Client
  Compiled with some errors in 6.20s

✖ 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

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

Unexpected end of JSON input

@torchsec-roni
Copy link
Author

torchsec-roni commented Nov 15, 2024

I just ran the following and got an empty result:

➜  my-website set | grep NODE_OPTIONS
➜  my-website set | grep NODE
➜  my-website set | grep -i NODE
➜  my-website

@slorber
Copy link
Collaborator

slorber commented Nov 15, 2024

Ah yes, my bad I was on v22.3 😅

I can also reproduce with v23.2 now

@slorber slorber removed the status: needs triage This issue has not been triaged by maintainers label Nov 15, 2024
@Josh-Cena
Copy link
Collaborator

webpack/webpack#18963, nodejs/node#55826 This is a Node regression that will be fixed!

@Josh-Cena Josh-Cena closed this as not planned Won't fix, can't repro, duplicate, stale Nov 16, 2024
@Josh-Cena Josh-Cena added the external This issue is caused by an external dependency and not Docusaurus. label Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution external This issue is caused by an external dependency and not Docusaurus.
Projects
None yet
Development

No branches or pull requests

3 participants