node-bencode
node-bencode copied to clipboard
Error: `Buffer.from` is not a function
What version of this package are you using? 2.0.2
What operating system, Node.js, and npm version? OS: KDE neon 5.23 (Ubuntu 20.04) Node version: v17.6.0 npm version: 8.5.1
What happened?
When running npm start, the following happened.
A JavaScript error occurred in the main process
Uncaught Exception:
TypeError: Buffer.from is not a function
at Object.<anonymous> (/home/zeankundev/nuTorrent/node_modules/bencode/lib/encode.js:49:22)
at Module._compile (module.js:428:26)
at Object.Module._extensions..js (module.js:446:10)
at Module.load (module.js:353:32)
at Function.Module._load (module.js:308:12)
at Module.require (module.js:363:17)
at require (module.js:382:17)
at Object.<anonymous> (/home/zeankundev/nuTorrent/node_modules/bencode/lib/index.js:3:18)
at Module._compile (module.js:428:26)
at Object.Module._extensions..js (module.js:446:10)
What did you expect to happen? Launching the application to debug
Are you willing to submit a pull request to fix this bug? No
Definitely odd, are you trying to load this in a frontend environment? What does your npm start directive do? Can you share a bit more about the setup, e.g.. if you are using webpack or something for a react app?
When I started it with npm start, it fires the following.
electron .
and starting hot server runs as following.
webpack-dev-server --config webpack/webpack-hot-dev-server.config.js --hot --progress --colors --port 2992 --inline
What version of webpack are you on? I know from v5 onwards they removed support for node polyfills, I don't know if that affects electron as well, but it would mean Buffer is unavailable.
Is your current project open source? If not, could you make a small electron project that just uses Buffer.from() and see if it works / share it?