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

(undefined) ReferenceError: Buffer is not defined #1257

Closed
mtooke opened this issue May 13, 2020 · 3 comments
Closed

(undefined) ReferenceError: Buffer is not defined #1257

mtooke opened this issue May 13, 2020 · 3 comments

Comments

@mtooke
Copy link

mtooke commented May 13, 2020

Hello,

I've got running locally within an instance of Docusaurus. Everything works perfectly (and looks great), however when I commit to GitLab, then try to deploy on GitLab pages I get the following error from the CI runner:

[2/4] Fetching packages...
 warning [email protected]: Invalid bin entry for "sha.js" (in "sha.js").
 info [email protected]: The platform "linux" is incompatible with this module.
 info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
 info [email protected]: The platform "linux" is incompatible with this module.
 info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
...

warning " > [email protected]" has incorrect peer dependency "styled-components@^4.1.1".
 warning "redoc > swagger2openapi > [email protected]" has unmet peer dependency "[email protected] - 6".
 warning " > [email protected]" has unmet peer dependency "react-is@>= 16.8.0".
 [4/4] Building fresh packages...
 success Saved lockfile.
 Done in 47.63s.
 $ yarn build
 yarn run v1.21.1
 $ docusaurus build
 Creating an optimized production build...
 [info] [webpackbar] Compiling Client
 [info] [webpackbar] Compiling Server
 [success] [webpackbar] Client: Compiled successfully in 50.81s
 [success] [webpackbar] Server: Compiled with some errors in 54.03s
 (undefined) ReferenceError: Buffer is not defined
     at Object.<anonymous> (main:11393:20)
     at __webpack_require__ (main:21:30)
     at Object.<anonymous> (main:22525:26)
     at __webpack_require__ (main:21:30)
     at Object.<anonymous> (main:69961:30)
     at __webpack_require__ (main:21:30)
     at Object.<anonymous> (main:32476:18)
     at __webpack_require__ (main:29216:30)
     at Object.<anonymous> (main:32247:14)
     at Object.<anonymous> (main:32470:30)
 Error: Failed to compile with errors.
     at /builds/tripdocs/visitor-platform/node_modules/@docusaurus/core/lib/commands/build.js:37:24
     at finalCallback (/builds/tripdocs/visitor-platform/node_modules/webpack/lib/MultiCompiler.js:254:12)
     at /builds/tripdocs/visitor-platform/node_modules/webpack/lib/MultiCompiler.js:277:6
     at done (/builds/tripdocs/visitor-platform/node_modules/neo-async/async.js:2931:13)
     at runCompilers (/builds/tripdocs/visitor-platform/node_modules/webpack/lib/MultiCompiler.js:181:48)
     at /builds/tripdocs/visitor-platform/node_modules/webpack/lib/MultiCompiler.js:188:7
     at /builds/tripdocs/visitor-platform/node_modules/webpack/lib/MultiCompiler.js:270:7
     at finalCallback (/builds/tripdocs/visitor-platform/node_modules/webpack/lib/Compiler.js:257:39)
     at /builds/tripdocs/visitor-platform/node_modules/webpack/lib/Compiler.js:273:13
     at AsyncSeriesHook.eval [as callAsync] (eval at create (/builds/tripdocs/visitor-platform/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:42:1)
     at AsyncSeriesHook.lazyCompileHook (/builds/tripdocs/visitor-platform/node_modules/tapable/lib/Hook.js:154:20)
     at onCompiled (/builds/tripdocs/visitor-platform/node_modules/webpack/lib/Compiler.js:271:21)
     at /builds/tripdocs/visitor-platform/node_modules/webpack/lib/Compiler.js:681:15
     at AsyncSeriesHook.eval [as callAsync] (eval at create (/builds/tripdocs/visitor-platform/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
     at AsyncSeriesHook.lazyCompileHook (/builds/tripdocs/visitor-platform/node_modules/tapable/lib/Hook.js:154:20)
     at /builds/tripdocs/visitor-platform/node_modules/webpack/lib/Compiler.js:678:31
 **ReferenceError: Buffer is not defined**
 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
 error Command failed with exit code 1.
 ERROR: Job failed: command terminated with exit code 1

Any help would be greatly appreciated!

@mtooke
Copy link
Author

mtooke commented May 14, 2020

Nevermind. This appears to be non-Redoc related.

@mtooke mtooke closed this as completed May 14, 2020
@csestito
Copy link

Did you find a solution for this? I am running into the same issue and it happened after adding ReDoc to my docusaurus site

@rittme
Copy link

rittme commented Sep 18, 2020

I have exactly the same issue. After adding ReDoc to docusaurus v2 I get this issue and builds fail.
The solution that worked for me was using the ProviderPlugin as mentioned webpack/changelog-v5#10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants