3

I am trying to deploy Docusaurus v2 and I keep getting this error:

Creating an optimized production build...

√ Client
  Compiled successfully in 18.44s

× Server
  Compiled with some errors in 20.74s
Error: Minified React error #321; visit https://reactjs.org/docs/error-decoder.html?invariant=321 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
...
...
...
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! website@0.0.0 deploy: `docusaurus deploy`
npm ERR! Exit status 1

I am working in a team, everyone is working off the same repo, and deploy seems to work for most people. The error-decoder link suggests it could be:

  1. Mismatching versions of React and React-dom.
  2. Breaking the Rules of Hooks.
  3. More than one copy of React in the same app.

I tried updating everything including React and react-dom.

I don't see how it could be 2 or 3 given it works for most people. Everything runs fine locally. Any suggestions on what to try in order to deploy?

Dillon
  • 1,394
  • 1
  • 11
  • 25
Max
  • 31
  • 2

1 Answers1

0

I had the same issue - I had tinkered with the default const {siteConfig} = useDocusaurusContext(); in index.js, moving it out of the function.

Worked once I moved it back into the function.

(might not help you since you say it works for some people, but hey, worked for me!)

Bojan Krkic
  • 349
  • 3
  • 10