facebook / docusaurus

Easy to maintain open source documentation websites.
https://docusaurus.io
MIT License
54.23k stars 8.13k forks source link

Migrating to alpha.70 throws error when no footer. #3936

Closed LoicPoullain closed 3 years ago

LoicPoullain commented 3 years ago

🐛 Bug Report

I updated my dependencies @docusaurus/core, @docusaurus/plugin-google-analytics and @docusaurus/preset-classic to 2.0.0-alpha.70. The npm start fails on this version. It looks like it's related to the fact that the website does not have a footer.

Have you read the Contributing Guidelines on issues?

Yes

To Reproduce

When I run npm start, the command fails in the terminal:

> docs@0.0.0 start /Users/loicpoullain/projects/FoalTS/foal/docs
> docusaurus start

Starting the development server...
TypeError: Cannot read property 'links' of undefined
    at getFooterTranslationFile (/Users/loicpoullain/projects/FoalTS/foal/docs/node_modules/@docusaurus/theme-classic/lib/translations.js:63:54)
    at getTranslationFiles (/Users/loicpoullain/projects/FoalTS/foal/docs/node_modules/@docusaurus/theme-classic/lib/translations.js:116:14)
    at Object.getTranslationFiles (/Users/loicpoullain/projects/FoalTS/foal/docs/node_modules/@docusaurus/theme-classic/lib/index.js:114:76)
    at /Users/loicpoullain/projects/FoalTS/foal/docs/node_modules/@docusaurus/core/lib/server/plugins/index.js:60:189
    at Array.map (<anonymous>)
    at Object.loadPlugins (/Users/loicpoullain/projects/FoalTS/foal/docs/node_modules/@docusaurus/core/lib/server/plugins/index.js:58:83)
    at async Object.load (/Users/loicpoullain/projects/FoalTS/foal/docs/node_modules/@docusaurus/core/lib/server/index.js:108:82)
    at async start (/Users/loicpoullain/projects/FoalTS/foal/docs/node_modules/@docusaurus/core/lib/commands/start.js:43:19)

Expected behavior

The server starts.

Actual Behavior

See above.

Your Environment

Reproducible Demo

Repo and branch: https://github.com/FoalTS/foal/tree/update-docusaurus-alpha-70/docs PR to highlight how the issue was been fixed: https://github.com/FoalTS/foal/pull/852

Workaround

The problem comes from docusaurus.config.js when there are no footer and footer.links properties. This may occur when the website has no footer.

It looks like a quick fix but I don't know if this issue needs to be addressed. Feel free to close if you think not.

slorber commented 3 years ago

Thanks, will handle that

slorber commented 3 years ago

should be fixed by canary release 2.0.0-alpha.ef49c2be7