Troubleshooting
Why is my app failing with a "Buffer is not found" error?
If you run into issues with Buffer and polyfills, try this solution:
Install the buffer dependency
Bash
npm i bufferCreate a new file polyfills.js in the root of your project
TypeScript
import { Buffer } from "buffer";
window.Buffer = window.Buffer ?? Buffer;On the first line of your main file, import polyfills
- ReacJS:
index.jsorindex.tsx - VueJS:
main.js - NuxtJS:
app.vue
TypeScript
//has to be on the first line of the file for it to work
import "./polyfills";