-
Notifications
You must be signed in to change notification settings - Fork 1.2k
TypeError: Cannot read property 'PrivKey' of undefined && Uncaught Error: Callback was already called. #963
Comments
I believe there is some confusion on this test, let me try to break it down from what I can understand reading the info you shared. Btw, thank you for sharing all the steps! a) You don't need to bring the repo module up All you need is just to do:
b) If you are looking to run this application on the browser, the path has no meaning with regards to your fs This might be confusing but essentially a Browser has no access to the local file system, it uses its own sandboxed datastore (LocalStorage or IndexedDB). This means that you can even simplify more your app.js to just:
Try it again with this latest node set up and let me know how it went :) |
thank you for your help. I tried both the a and b methods. The browser's console produces the same error.
|
@diandianxiyu which browser are you using? |
Chrome 60.0.3112.101 |
This is the same issue as #964 Learn more about the actual problem here: libp2p/js-libp2p-crypto#105 |
Safari support is here now! #995 (comment) |
This PR adds `crypto-browserify` to the dependencies and replaces `crypto` with `crypto-browserify` when bundled in the browser. In files that require webcrypto we check to see if it's available. If it is not we require the Node.js implementation (which has `crypto` replaced with `crypto-browserify`) and if it is available then we use the webcrypto version (so we get fast crypto). Shipping `crypto-browserify` adds to the bundle size: Current gzipped size: 142,824 bytes New gzipped size: 214,499 bytes Difference: **+71,675 bytes** It's not an insignificant addition so we need to decide whether this is worth it. If not accepted, we need to add checks when libp2p-crypto methods are called and callback with an appropriate error message. JS IPFS will continue to have issues opened with confusion around this otherwise! See ipfs/js-ipfs#963 ipfs/js-ipfs#964 ipfs/js-ipfs#2153 resolves #105 License: MIT Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
Version:
js-ipfs version: 0.25.1
Platform:
Darwin localhost 16.6.0 Darwin Kernel Version 16.6.0: Fri Apr 14 16:21:16 PDT 2017; root:xnu-3789.60.24~6/RELEASE_X86_64 x86_64
Subsystem:
Type:
Bug
Severity:
High
Description:
init local jsipfs repo
and then init ipfs
BUT
Console ->
Steps to reproduce the error:
code:
/src/app.js
package.json
commands
The text was updated successfully, but these errors were encountered: