ReferenceError: Buffer is not defined
See original GitHub issueSeems like starknet.js is depending on libraries relying on polyfills (like Buffer) which modern framework do not like
Using vite.js I get
ReferenceError: Buffer is not defined
at ../node_modules/.pnpm/@ledgerhq+devices@6.27.1/node_modules/@ledgerhq/devices/lib/hid-framing.js (http://localhost:3000/node_modules/.vite/starknet.js?v=53067631:25687:13)
at __require2 (http://localhost:3000/node_modules/.vite/chunk-UC7LELEO.js?v=53067631:48:44)
at ../node_modules/.pnpm/@ledgerhq+hw-transport-webhid@6.27.1/node_modules/@ledgerhq/hw-transport-webhid/lib-es/TransportWebHID.js (http://localhost:3000/node_modules/.vite/starknet.js?v=53067631:28215:37)
at __init (http://localhost:3000/node_modules/.vite/chunk-UC7LELEO.js?v=53067631:45:50)
at ../node_modules/.pnpm/starknet@3.9.0/node_modules/starknet/dist/signer/ledger.js (http://localhost:3000/node_modules/.vite/starknet.js?v=53067631:28687:50)
at __require2 (http://localhost:3000/node_modules/.vite/chunk-UC7LELEO.js?v=53067631:48:44)
at ../node_modules/.pnpm/starknet@3.9.0/node_modules/starknet/dist/signer/index.js (http://localhost:3000/node_modules/.vite/starknet.js?v=53067631:28812:18)
at __require2 (http://localhost:3000/node_modules/.vite/chunk-UC7LELEO.js?v=53067631:48:44)
at ../node_modules/.pnpm/starknet@3.9.0/node_modules/starknet/dist/account/default.js (http://localhost:3000/node_modules/.vite/starknet.js?v=53067631:29057:20)
at __require2 (http://localhost:3000/node_modules/.vite/chunk-UC7LELEO.js?v=53067631:48:44)
Any idea how to get passed that ?
Issue Analytics
- State:
- Created a year ago
- Comments:7
Top Results From Across the Web
Uncaught ReferenceError: Buffer is not defined - Stack Overflow
Answering my own question. Two things helped to resolve the issue: Adding plugins section with ProviderPlugin into webpack.config.js.
Read more >Uncaught ReferenceError: Buffer is not defined #2248 - GitHub
If you install polyfill buffer package, you get the error: It appears you're using a module that is built in to node, but...
Read more >Buffer is not defined. Using Phantom Wallet, Solana and ...
testing - Uncaught ReferenceError: Buffer is not defined. Using Phantom Wallet, Solana and React to make a transaction - Solana Stack Exchange. ...
Read more >ReferenceError: Buffer is not defined - Homey Community Forum
I am running Homey 7.4.1 and HomeyScript v3.3.0. Restarted HomeyScript and also have restarted Homey. No change. No other installs etc done.
Read more >How to polyfill Buffer with Webpack 5 - viglucci.io
The "buffer is not defined" error is a common error that can occur when trying to use the Buffer Node.js API in an...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As I can see the error seems to be coming from ledger dependencies used in starknet.js.
@ledgerhq/hw-transport-webusb
this dependency is causing the issue.If you go on their github, you will find the open issue
should be solved as ledger was removed