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

[bug] npx create-docusaurus failing on node.js 20.6.0 npm 10.0.0 #9286

Closed
5 of 7 tasks
homotechsual opened this issue Sep 6, 2023 · 5 comments
Closed
5 of 7 tasks
Labels
bug An error in the Docusaurus core causing instability or issues with its execution closed: duplicate This issue or pull request already exists in another issue or pull request

Comments

@homotechsual
Copy link
Contributor

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

Cannot create site using npx create-docusaurus using node v 20.6.0 - fails with common.register is not a function.

This works if reverting back to node LTS.

Reproducible demo

No response

Steps to reproduce

Install node version 20.6.0
Install npm version 10.0.0

Run npx create-docusaurus@latest docusaurusnode20test classic --typescript

Expected behavior

Should create a new docusaurus classic site using Typescript.

Actual behavior

Errors:

PS>npx create-docusaurus@latest docusaurusnode20test classic --typescript
Need to install the following packages:
create-docusaurus@2.4.1
Ok to proceed? (y)
npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
(node:29016) Warning: Accessing non-existent property 'register' of module exports inside circular dependency
(Use node --trace-warnings ... to show where the warning was created)
[ERROR] TypeError: common.register is not a function

Your environment

  • Docusaurus version used: 2.4.1
  • Environment name and version (e.g. Chrome 89, Node.js 16.4): Node.js 20.6.0, NPM 10.0.0
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS): Windows 11 Pro

Self-service

  • I'd be willing to fix this bug myself.
@homotechsual homotechsual 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 Sep 6, 2023
@rogervdf
Copy link

rogervdf commented Sep 6, 2023

Similar issue starting a few hours ago:

#17 10.28 [ERROR] TypeError: common.register is not a function
#17 10.30 npm notice 
#17 10.30 npm notice New major version of npm available! 9.8.1 -> 10.0.0
#17 10.30 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.0.0>
#17 10.30 npm notice Run `npm install -g npm@10.0.0` to update!
#17 10.30 npm notice 
#17 ERROR: process "/bin/sh -c npx --yes create-docusaurus@latest template classic" did not complete successfully: exit code: 1

I can also confirm that by pinning at 20.5 all is good, it's 20.6 specifically that breaks something

@slorber
Copy link
Collaborator

slorber commented Sep 7, 2023

Wonder if it's related to #9278, will investigate later

@slorber slorber removed the status: needs triage This issue has not been triaged by maintainers label Sep 7, 2023
@slorber
Copy link
Collaborator

slorber commented Sep 7, 2023

Probably related to nodejs/node#49497

@Seburan
Copy link

Seburan commented Sep 8, 2023

we started also to get the same error on september 6th when running "docusaurus build" in our CI/CD pipeline on Cloud Build using the default "node:latest" image.

Step #5 - "npm-run-build-home": > docusaurus build
Step #5 - "npm-run-build-home": 
Step #5 - "npm-run-build-home": /workspace/services/home/node_modules/@docusaurus/utils/lib/index.js:9
Step #5 - "npm-run-build-home": exports.replaceMarkdownLinks = exports.writeMarkdownHeadingId = exports.parseMarkdownString = exports.parseMarkdownContentTitle = exports.parseFrontMatter = exports.createExcerpt = exports.parseMarkdownHeadingId = exports.groupTaggedItems = exports.normalizeFrontMatterTags = exports.buildSshUrl = exports.buildHttpsUrl = exports.hasSSHProtocol = exports.removeTrailingSlash = exports.addTrailingSlash = exports.addLeadingSlash = exports.resolvePathname = exports.isValidPathname = exports.encodePath = exports.fileToPath = exports.getEditUrl = exports.normalizeUrl = exports.findAsyncSequential = exports.mapAsyncSequential = exports.removePrefix = exports.removeSuffix = exports.localizePath = exports.getPluginI18nPath = exports.updateTranslationFileMessages = exports.mergeTranslations = exports.GitNotFoundError = exports.FileNotTrackedError = exports.getFileCommitDate = exports.readOutputHTMLFile = exports.generate = exports.WEBPACK_URL_LOADER_LIMIT = exports.DEFAULT_PLUGIN_ID = exports.DEFAULT_PORT = exports.CODE_TRANSLATIONS_FILE_NAME = exports.DEFAULT_I18N_DIR_NAME = exports.THEME_PATH = exports.OUTPUT_STATIC_ASSETS_DIR_NAME = exports.DEFAULT_STATIC_DIR_NAME = exports.SRC_DIR_NAME = exports.GENERATED_FILES_DIR_NAME = exports.BABEL_CONFIG_FILE_NAME = exports.DEFAULT_CONFIG_FILE_NAME = exports.DEFAULT_BUILD_DIR_NAME = exports.DOCUSAURUS_VERSION = exports.NODE_MINOR_VERSION = exports.NODE_MAJOR_VERSION = void 0;
Step #5 - "npm-run-build-home":                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
Step #5 - "npm-run-build-home": 
Step #5 - "npm-run-build-home": TypeError: Cannot set property NODE_MAJOR_VERSION of #<Object> which has only a getter
Step #5 - "npm-run-build-home":     at Object.<anonymous> (/workspace/services/home/node_modules/@docusaurus/utils/lib/index.js:9:1421)
Step #5 - "npm-run-build-home":     at Module._compile (node:internal/modules/cjs/loader:1241:14)
Step #5 - "npm-run-build-home":     at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
Step #5 - "npm-run-build-home":     at Module.load (node:internal/modules/cjs/loader:1091:32)
Step #5 - "npm-run-build-home":     at Module._load (node:internal/modules/cjs/loader:938:12)
Step #5 - "npm-run-build-home":     at Module.require (node:internal/modules/cjs/loader:1115:19)
Step #5 - "npm-run-build-home":     at require (node:internal/modules/helpers:130:18)
Step #5 - "npm-run-build-home":     at Object.<anonymous> (/workspace/services/home/node_modules/@docusaurus/utils/lib/dataFileUtils.js:15:17)
Step #5 - "npm-run-build-home":     at Module._compile (node:internal/modules/cjs/loader:1241:14)
Step #5 - "npm-run-build-home":     at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
Step #5 - "npm-run-build-home": 
Step #5 - "npm-run-build-home": Node.js v20.6.0

now reverting to build image "node:lts" until it's fixed.

@slorber slorber added the closed: duplicate This issue or pull request already exists in another issue or pull request label Sep 8, 2023
@slorber
Copy link
Collaborator

slorber commented Sep 8, 2023

Duplicate of #9291

@slorber slorber marked this as a duplicate of #9291 Sep 8, 2023
@slorber slorber closed this as not planned Won't fix, can't repro, duplicate, stale Sep 8, 2023
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 closed: duplicate This issue or pull request already exists in another issue or pull request
Projects
None yet
Development

No branches or pull requests

4 participants