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

[v2.alpha.62] sidebars.json is required after upgrading from alpha.61 to alpha.62 #3366

Closed
MateuszDabrowski opened this issue Aug 30, 2020 · 9 comments · Fixed by #3381
Closed
Labels
bug An error in the Docusaurus core causing instability or issues with its execution

Comments

@MateuszDabrowski
Copy link

🐛 Bug Report

After update from alpha.61 to alpha.62 I'm not able to start a server with my website due to a missing 'sidebars.json' file. It was not required previously. I'm using custom sidebar js files for multiple doc roots: https://github.com/MateuszDabrowski/mateuszdabrowski.pl (one in /docs, one in /ideas)

Have you read the Contributing Guidelines on issues?

Yes

To Reproduce

(Write your steps here:)

  1. Update package.json to alpha.62
  2. npm run start
  3. Error: The sidebar file does not exist for version [current]. A sidebar file is expected to be found at /Users/md/Documents/Code/JS/md/sidebars.json

Expected behavior

The website should compile without the need for sidebars.json if there are custom sidebars assigned in docusaurus config.

Actual Behavior

The compile breaks with error:

Error: The sidebar file does not exist for version [current]. A sidebar file is expected to be found at /Users/md/Documents/Code/JS/md/sidebars.json
    at checkVersionMetadataPaths (/Users/md/Documents/Code/JS/md/node_modules/@docusaurus/plugin-content-docs/lib/versions.js:135:15)
    at Array.forEach (<anonymous>)
    at Object.readVersionsMetadata (/Users/md/Documents/Code/JS/md/node_modules/@docusaurus/plugin-content-docs/lib/versions.js:171:22)
    at pluginContentDocs (/Users/md/Documents/Code/JS/md/node_modules/@docusaurus/plugin-content-docs/lib/index.js:27:41)
    at /Users/md/Documents/Code/JS/md/node_modules/@docusaurus/core/lib/server/plugins/init.js:72:48
    at Array.map (<anonymous>)
    at Object.initPlugins [as default] (/Users/md/Documents/Code/JS/md/node_modules/@docusaurus/core/lib/server/plugins/init.js:27:10)
    at Object.loadPlugins (/Users/md/Documents/Code/JS/md/node_modules/@docusaurus/core/lib/server/plugins/index.js:49:35)
    at Object.load (/Users/md/Documents/Code/JS/md/node_modules/@docusaurus/core/lib/server/index.js:78:74)
    at FSWatcher.reload (/Users/md/Documents/Code/JS/md/node_modules/@docusaurus/core/lib/commands/start.js:47:18)
    at FSWatcher.emit (events.js:315:20)
    at FSWatcher.emitWithAll (/Users/md/Documents/Code/JS/md/node_modules/chokidar/index.js:534:8)
    at FSWatcher._emit (/Users/md/Documents/Code/JS/md/node_modules/chokidar/index.js:626:8)
    at FSWatcher._remove (/Users/md/Documents/Code/JS/md/node_modules/chokidar/index.js:880:50)
    at FsEventsHandler.handleEvent (/Users/md/Documents/Code/JS/md/node_modules/chokidar/lib/fsevents-handler.js:266:16)
    at FsEventsHandler.checkExists (/Users/md/Documents/Code/JS/md/node_modules/chokidar/lib/fsevents-handler.js:254:12)

Adding sidebars.json file with {} content solves this issue.

Might be connected to #3362

Your Environment

  • Docusaurus version used: alpha.62
  • Environment name and version (VSCode Version: 1.48.2, node v14.2.0):
  • Operating system and version (desktop or mobile): Macbook Pro on Catalina 10.15.6

Reproducible Demo

https://github.com/MateuszDabrowski/mateuszdabrowski.pl/tree/772446b0b3a84c69d02cf18c290248818501151b + bump the version of docusaurus to alpha.62

@MateuszDabrowski MateuszDabrowski 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 Aug 30, 2020
@MateuszDabrowski MateuszDabrowski changed the title (v2) sidebars.json is required after upgrading from alpha.61 to alpha.62 [v2.alpha.62] sidebars.json is required after upgrading from alpha.61 to alpha.62 Aug 30, 2020
@slorber
Copy link
Collaborator

slorber commented Aug 30, 2020

Thanks, this is related to a big docs plugin refactor here: #3245

Will make the sidebars optional again in next release

@slorber
Copy link
Collaborator

slorber commented Aug 31, 2020

BTW as a side note, instead of your "sites" docs instance without any sidebar, you could also try to use Markdown Pages, released recently.

What's the motivation to use docs plugin for the sites URLs like https://mateuszdabrowski.pl/sites/my-toolset on your site? (this probably make sense, just curious to see if we could improve md pages to support better this usecase)

@slorber
Copy link
Collaborator

slorber commented Aug 31, 2020

Will be fixed in #3376

Still kept a yellow warning as using docs without sidebar is probably a niche usecase

@MateuszDabrowski
Copy link
Author

Ahoj @slorber,

As for /sites path and my-toolset - I opted for making it a docs page because of the markdown support and built-in table of contents (could have swizzled it, but wanted to wait to post-alpha stage with swizzling). Same for pages like http://localhost:3000/sites/privacy or http://localhost:3000/sites/licence
Markdown Pages makes one of the reason no longer valid, so once table of contents is supported for pages just as for docs (or once the docusaurus v2 development reach beta to be stable enough for swizzling) I will move them to be pages instead of pseudo-docs.

As for yellow warning - I would say that if the docusarus config links to a custom sidebar, it should not trigger a warning, as it shows purposeful omission of the default approach.

@slorber
Copy link
Collaborator

slorber commented Sep 3, 2020

Released alpha 63 🎊 please spread the word 🙏
https://twitter.com/docusaurus/status/1301562737693138944
https://github.com/facebook/docusaurus/releases/tag/v2.0.0-alpha.63

@MateuszDabrowski
Copy link
Author

Confirmed! The label also disappeared from the pages :)

@slorber
Copy link
Collaborator

slorber commented Apr 7, 2021

FYI soon a site without sidebars.json will have its sidebar autogenerated by default.
Not sure if this affects you, just wanted to let you know.
#4582

@MateuszDabrowski
Copy link
Author

Thank you for the heads up @slorber !
Tested my site and it seems that with the addition of empty sidebars.json I should be ok with my custom sidebar on the folder level. And from what I have seen in #4582 this {} sidebar.json should be enough to block autogeneration.

@slorber
Copy link
Collaborator

slorber commented May 18, 2021

we are doing changes so that the empty sidebar file is not required anymore.

Please subscribe to #4775 and let me know if this still works fine for you when we merge those changes

@Josh-Cena Josh-Cena removed the status: needs triage This issue has not been triaged by maintainers label Mar 24, 2022
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants