Open mrfoxie opened 4 years ago
Could you provide more context? All I see here is warnings. Webpack config files and scripts were removed from bcoin a while ago: https://github.com/bcoin-org/bcoin/pull/741
I'm trying to install bcoin browser from this site Run a bcoin full node in a web browser I tried it using superuser mode in my system here is the screenshot of it. I'm trying to give style to browser section like this
Sorry the browser node guide is outdated now, and its such bad practice to run a node in a web browser anyway, its not really worth updating. We should probably just remove it.
You can take a look at this guide that explains how to use bpkg
to compile individual modules for the browser: https://bcoin.io/guides/webapp
Or check out this repo, where I use bpkg
to compile a bcoin full node into a cleaner bootstrap interface: https://github.com/pinheadmz/mobilebcoin
mkdir <new dir for your app>
cd <wherever your bcoin repo is installed>
bpkg --browser --standalone --plugin [ uglify-es --toplevel ] --name HD \
--output <your new app dir>/HD.js lib/hd/index.js
when I use this comment it gave error Invalid argument: --standalone.
I believe standalone
has been replaced with umd
please read the documentation here: https://github.com/chjj/bpkg
I tried it didn't work and I got this error
root@kali:/home/kali/bcoin# npm install -g bpkg
/usr/local/bin/bpkg -> /usr/local/lib/node_modules/bpkg/bin/bpkg
+ bpkg@0.6.0
added 1 package from 1 contributor in 8.551s
root@kali:/home/kali/bcoin# npm install -g uglify-es
/usr/local/bin/uglifyjs -> /usr/local/lib/node_modules/uglify-es/bin/uglifyjs
+ uglify-es@3.3.9
added 3 packages from 38 contributors in 3.967s
root@kali:/home/kali/bcoin# pwd
/home/kali/bcoin
root@kali:/home/kali/bcoin# ls
bench bin browser CHANGELOG.md docs etc jsdoc.json lib LICENSE migrate node_modules package.json README.md scripts snap test
root@kali:/home/kali/bcoin# bpkg --browser --umd --plugin [ uglify-es --toplevel ] --name HD \ --output /home/kali/bcoin/browser/HD.js lib/hd/index.js
Error: Cannot find module: '/home/kali/bcoin/ --output'
at Resolver.resolve (/usr/local/lib/node_modules/bpkg/lib/resolver.js:338:19)
and I'm running as a supper user this is the screenshot
This command worked for me:
bpkg --browser --umd --name HD --plugin uglify-es \
--output /home/pinheadmz/Desktop/work/bpkgtest/bcoin-hd.js lib/hd/index.js
Then create index.html
:
<html>
<head></head>
<body>
test
<script type="text/javascript" src="bcoin-hd.js"></script>
</body>
</html>
if I add this HD.js script in browser folder and then include it in index.html wull it work
yup. i think so :-) That's how this works: https://github.com/pinheadmz/bcoin-webapp
its working but there is a question i want to ask can i make like this from this codes https://bcoin.io/browser/
its working but there is a question i want to ask can i make like this from this codes https://bcoin.io/browser/
You would have to do some patching yourself - the browser node guide, as you've discovered, is outdated and the actual webapp hosted on bcoin.io is running a patchset on top of a 2-year-old build of bcoin: https://github.com/pinheadmz/bcoin/commits/browserserver
If you really want to recreate the bcoin.io webapp you can try building it from that branch in my repo. Notice in that branch I've actually built four different bcoin's (testnet/main, spv/full) and commited the webpack output already.
okay i will check and tell you
its working but there is a question i want to ask can i make like this from this codes https://bcoin.io/browser/
You would have to do some patching yourself - the browser node guide, as you've discovered, is outdated and the actual webapp hosted on bcoin.io is running a patchset on top of a 2-year-old build of bcoin: https://github.com/pinheadmz/bcoin/commits/browserserver
If you really want to recreate the bcoin.io webapp you can try building it from that branch in my repo. Notice in that branch I've actually built four different bcoin's (testnet/main, spv/full) and commited the webpack output already.
as im trying it but i got this error
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies. npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2. npm WARN notsup Unsupported engine for watchpack-chokidar2@2.0.0: wanted: {"node":"<8.10.0"} (current: {"node":"14.4.0","npm":"6.14.5"}) npm WARN notsup Not compatible with your version of node/npm: watchpack-chokidar2@2.0.0 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules/chokidar/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/watchpack-chokidar2/node_modules/chokidar/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm64"})
1 package is looking for funding run
npm fund
for details