Docusaurus: `v2.0.0-alpha.56` Breaks All Builds

Created on 29 May 2020  路  6Comments  路  Source: facebook/docusaurus

馃悰 Bug Report

This issue has to do with the following packages:

  • @docusaurus/core v2.0.0-alpha.56
  • @docusaurus/preset-classic v2.0.0-alpha.56


Click to view package.json

// ...
  "dependencies": {
    "@docusaurus/core": "2.0.0-alpha.56",
    "@docusaurus/preset-classic": "2.0.0-alpha.56",
    "@docusaurus/theme-live-codeblock": "^2.0.0-alpha.56",
    "@material-ui/core": "^4.10.0",
    "@material-ui/icons": "^4.9.1",
    "@mdx-js/mdx": "^1.6.4",
    "classnames": "^2.2.6",
    "cross-env": "^7.0.2",
    "dotenv": "^8.2.0",
    "fs-extra": "^9.0.0",
    "github-slugger": "^1.3.0",
    "gray-matter": "^4.0.2",
    "loader-utils": "^2.0.0",
    "material-table": "^1.57.2",
    "mdast-util-to-string": "^1.1.0",
    "react": "^16.8.4",
    "react-dom": "^16.8.4",
    "react-live": "^2.2.2",
    "react-markdown": "^4.3.1",
    "remark-emoji": "^2.1.0",
    "stringify-object": "^3.3.0",
    "unist-util-visit": "^2.0.2"
  },
// ...


In Summary

  • Upgrading from 2.0.0-alpha.55 to 2.0.0-alpha.56 breaks all builds

Things I Have Tried:

  • Verified @docusaurus/theme-live-codeblock is installed and upgraded (see second error below for more info)
  • Removed node_modules and then yarn install
  • Ran yarn cache clean, removed node_modules, and then yarn install

The Fix:

  • Downgrading back to v2.0.0-alpha.55 resolves the issue.

Detailed Summary

After upgrading @docusaurus/core from v2.0.0-alpha.55 to v2.0.0-alpha.56 I receive the following error when running yarn start or yarn build (the important thing to note is the module Cannot find module '@docusaurus/plugin-content-docs'):


Click me to view error

$ docusaurus start
Starting the development server...
Error: Cannot find module '@docusaurus/plugin-content-docs'
Require stack:
- /Users/User/Path/To/Project
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:976:15)
    at Function.resolve (internal/modules/cjs/helpers.js:78:19)
    at /Users/User/Path/To/Project/node_modules/@docusaurus/core/lib/server/plugins/init.js:40:67
    at Array.map (<anonymous>)
    at Object.initPlugins (/Users/User/Path/To/Project/node_modules/@docusaurus/core/lib/server/plugins/init.js:22:10)
    at Object.loadPlugins (/Users/User/Path/To/Project/node_modules/@docusaurus/core/lib/server/plugins/index.js:47:28)
    at Object.load (/Users/User/Path/To/Project/node_modules/@docusaurus/core/lib/server/index.js:57:62)
    at start (/Users/User/Path/To/Project/node_modules/@docusaurus/core/lib/commands/start.js:45:34)
    at /Users/User/Path/To/Project/node_modules/@docusaurus/core/bin/docusaurus.js:29:5
    at Command.<anonymous> (/Users/User/Path/To/Project/node_modules/@docusaurus/core/bin/docusaurus.js:97:23)
    at Command.listener (/Users/User/Path/To/Project/node_modules/commander/index.js:370:29)
    at Command.emit (events.js:315:20)
    at Command.parseArgs (/Users/User/Path/To/Project/node_modules/commander/index.js:892:12)
    at Command.parse (/Users/User/Path/To/Project/node_modules/commander/index.js:642:21)
    at Object.<anonymous> (/Users/User/Path/To/Project/node_modules/@docusaurus/core/bin/docusaurus.js:120:5)
    at Module._compile (internal/modules/cjs/loader.js:1147:30)

From there, I upgraded @docusaurus/preset-classic from v2.0.0-alpha.55 to v2.0.0-alpha.56, which produces the following error (again, note the package name - it's different this time):


Click me to view error

$ docusaurus start
Starting the development server...
Error: Cannot find module '@docusaurus/theme-live-codeblock'
Require stack:
- /Users/User/Path/To/Project
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:976:15)
    at Function.resolve (internal/modules/cjs/helpers.js:78:19)
    at /Users/User/Path/To/Project/node_modules/@docusaurus/core/lib/server/plugins/init.js:40:67
    at Array.map (<anonymous>)
    at Object.initPlugins (/Users/User/Path/To/Project/node_modules/@docusaurus/core/lib/server/plugins/init.js:22:10)
    at Object.loadPlugins (/Users/User/Path/To/Project/node_modules/@docusaurus/core/lib/server/plugins/index.js:47:28)
    at Object.load (/Users/User/Path/To/Project/node_modules/@docusaurus/core/lib/server/index.js:57:62)
    at start (/Users/User/Path/To/Project/node_modules/@docusaurus/core/lib/commands/start.js:45:34)
    at /Users/User/Path/To/Project/node_modules/@docusaurus/core/bin/docusaurus.js:29:5
    at Command.<anonymous> (/Users/User/Path/To/Project/node_modules/@docusaurus/core/bin/docusaurus.js:97:23)
    at Command.listener (/Users/User/Path/To/Project/node_modules/commander/index.js:370:29)
    at Command.emit (events.js:315:20)
    at Command.parseArgs (/Users/User/Path/To/Project/node_modules/commander/index.js:892:12)
    at Command.parse (/Users/User/Path/To/Project/node_modules/commander/index.js:642:21)
    at Object.<anonymous> (/Users/User/Path/To/Project/node_modules/@docusaurus/core/bin/docusaurus.js:120:5)
    at Module._compile (internal/modules/cjs/loader.js:1147:30)

---

Original Questionnaire

Have you read the Contributing Guidelines on issues?

Yes

To Reproduce

  1. Upgrade @docusaurus/core and @docusaurus/preset-classic to v2.0.0-alpha.56
  2. yarn start

Expected behavior

Project to start and/or build.

Actual Behavior

Errors (see errors above)

Your Environment

  • Docusaurus version used: 2.0.0-alpha.56
  • Environment name and version (e.g. Chrome 78.0.3904.108, Node.js 10.17.0): Node: v13.12.0, Firefox: 76.0.1
  • Operating system and version (desktop or mobile): Catalina 10.15.4

Reproducible Demo

Unable to provide a link for this issue - it's one of those issues you have to test locally.

bug needs triage

Most helpful comment

@SamChou19815 Ah I see, make sense.

So if I understand well the next version will allow the simple string notation again?

Yes

All 6 comments

There's a breaking change in the way plugins are imported, please see the release notes - https://github.com/facebook/docusaurus/releases/tag/v2.0.0-alpha.56

@yangshun Apologies! Thank you.

@SamChou19815 Why is this not documented? I think https://github.com/facebook/docusaurus/pull/2788 should had the doc updated together with the code. Otherwise it kind of defeats the main goal of docusaurus: "documentation as code" so that it's always in sync with the code.

@SamChou19815 Why is this not documented? I think #2788 should had the doc updated together with the code. Otherwise it kind of defeats the main goal of docusaurus: "documentation as code" so that it's always in sync with the code.

It is a regression and an unintended bug. My original intention is to ensure users don't have to change docusaurus.config.js, that's why it's not documented. It has been fixed in #2829.

@SamChou19815 Ah I see, make sense.
So if I understand well the next version will allow the simple string notation again?

@SamChou19815 Ah I see, make sense.

So if I understand well the next version will allow the simple string notation again?

Yes

Was this page helpful?
0 / 5 - 0 ratings