bitcore-lib icon indicating copy to clipboard operation
bitcore-lib copied to clipboard

Using bitcore-lib in browser (jquery)

Open varunagarwal315 opened this issue 8 years ago • 1 comments

I tried to use gulp browser to build the .js file but got this error

Error: spawn ./node_modules/.bin/browserify --require ./index.js:bitcore-lib -o bitcore-lib.js ENOENT
    at exports._errnoException (util.js:870:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
    at onErrorNT (internal/child_process.js:344:16)
    at nextTickCallbackWith2Args (node.js:441:9)
    at process._tickCallback (node.js:355:17)
    at Function.Module.runMain (module.js:444:11)
    at startup (node.js:136:18)
    at node.js:966:3

i understand this is an error to do with browserfiy but am unable to fix it so far. Wanted to know if there is any difference between using this method and directly calling bower install bitcore-lib. When I include the bitcore-lib file in bower_components, the browser is unable to recognize the word bitcore which is what afaik should be the reserved key word for referring to this library in bower

Also in the Building the Browser Bundle section, the link https://github.com/bitpay/bitcore-lib/commit/e33b6e3ba6a1e5830a079e02d949fce69ea33546 seems to be broken for me. Just thought I would bring that up.

I am basically trying to make a custom brain wallet using bitcore-lib in which all relevant code will be in the browser side itself, using jquery for now. This will be used to create addresses, keys, send and receive transactions on a fork of bitcoin repository. Needed some help/ advice with the above. Thanks

gulp test is running smoothly for me I have also used npm install and run this library in another app using nodejs

varunagarwal315 avatar Apr 11 '17 07:04 varunagarwal315

I get this error too; If you include from bower_components you should use "var bitcore = require('bitcore-lib');" not "var bitcore = require('bitcore');"

cloudop avatar Nov 14 '17 10:11 cloudop