Build fails with error ReferenceError: Prism is not defined at Array.forEach (<anonymous>)

See original GitHub issue

I use the freshest installation and make only one change, I add language to prism.

docusaurus.config.js

  prism: {
    theme: lightCodeTheme,
    darkTheme: darkCodeTheme,
    additionalLanguages: ['php'], // <- this is the only change i made
  },

After that, if I try to build the project - it fails with this error:

ReferenceError: Prism is not defined
    at Array.forEach (<anonymous>)
[ERROR] Unable to build website for locale en.
[ERROR] Error: Failed to compile with errors.
error Command failed with exit code 1.

Any ideas how to fix that?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
ltriboletcommented, Mar 23, 2022
rm -rf node_modules
rm yarn.lock
➜ yarn docusaurus build
yarn run v1.22.5
$ docusaurus build
[INFO] [en] Creating an optimized production build...

✔ Client


✔ Server
  Compiled successfully in 10.81s


✔ Client


● Server █████████████████████████ cache (99%) shutdown IdleFileCachePlugin
 stored

[SUCCESS] Generated static files in build.
[INFO] Use `npm run serve` command to test your build locally.
✨  Done in 15.97s.

It did the trick, thank you!

1reaction
slorbercommented, Mar 23, 2022

Hey, just published a fix, please try initializing a new project or re-generate your lockfile and let me know if this works

yarn why eval should report using eval@0.1.6 and not eval@0.1.7

Same issue as in https://github.com/facebook/docusaurus/pull/6975

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prismjs not working error Prism is not defined - Stack Overflow
I faced the same issue while working on one of react projects where I was using Prism. I solved it by installing prismjs...
Read more >
JavaScript Q & A | Teja Live Tracks
It returns the character at the specified index. forEach(), It calls a function for each element in the array. indexOf(), It returns the...
Read more >
global is not defined react - You.com | The AI Search Engine ...
So I am writing unit test using "react-testing-library" on Jest and I have this error: Test suite failed to run ReferenceError: global is...
Read more >
Full text of "JavaScript Notes for Professionals" - Internet Archive
Error ! forEach is not defined. function func() { console. log (arguments) ; } func(1, 2, 3); // - [1, 2, 3] Convert...
Read more >
JavaScript Notes for Professionals
not a liated with o cial JavaScript® group(s) or company(s). ... identifier foo against undefined could throw a Reference Error, use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found