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

Cannot read properties of undefined (reading 'call') #1865

Closed
bubu59 opened this issue Jan 31, 2023 · 5 comments
Closed

Cannot read properties of undefined (reading 'call') #1865

bubu59 opened this issue Jan 31, 2023 · 5 comments

Comments

@bubu59
Copy link

bubu59 commented Jan 31, 2023

When importing bitcoinjs-lib into my react project, I get the following error:

      `Uncaught TypeError: Cannot read properties of undefined (reading 'call')
          at Hash.CipherBase (index.js:6:1)
          at new Hash (browser.js:9:1)
          at createHash (browser.js:23:1)
          at sha256 (crypto.js:26:1)
          at crypto.js:40:1
          at Array.map (<anonymous>)
          at ./node_modules/bitcoinjs-lib/src/crypto.js (crypto.js:39:1)
          at options.factory (react refresh:6:1)
          at __webpack_require__ (bootstrap:24:1)
          at fn (hot module replacement:62:1)`

I have referenced to this repo https://github.com/crypto-browserify/cipher-base/issues/11 but it doesn't seem to solve the issue.

@bubu59
Copy link
Author

bubu59 commented Jan 31, 2023

Referring to my own question above, when I looked into Hash.Cipherbase, it points to the error highlighted in the screenshot below.

Screenshot 2023-01-31 at 2 48 09 PM

I have tried to polyfill it with stream(refer to screenshot below) but to no avail.. I have also installed stream which is present in my package.json.

Screenshot 2023-01-31 at 2 53 29 PM

@ChrisCho-H
Copy link
Contributor

Change the second line of index.js of Cipherbase,
from
require('stream').Transform
to
require('readable-stream')

@bubu59
Copy link
Author

bubu59 commented Feb 9, 2023

Thank you! Will give it a shot!

@junderw
Copy link
Member

junderw commented Dec 29, 2023

Fixed by switching over to noble crypto.

@junderw junderw closed this as completed Dec 29, 2023
@imfaker
Copy link

imfaker commented Jun 4, 2024

fix it by use 'vite-plugin-node-polyfills'. when use vite

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

4 participants