bcoin icon indicating copy to clipboard operation
bcoin copied to clipboard

npm install webpack installation error

Open mrfoxie opened this issue 3 years ago • 13 comments

npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated npm WARN deprecated [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies. npm WARN deprecated [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2. npm WARN notsup Unsupported engine for [email protected]: 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: [email protected] 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 [email protected]: 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 [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm64"})

1 package is looking for funding run npm fund for details

mrfoxie avatar Jul 19 '20 17:07 mrfoxie

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

pinheadmz avatar Jul 20 '20 15:07 pinheadmz

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. Screenshot (8) I'm trying to give style to browser section like this Screenshot (9)

mrfoxie avatar Jul 21 '20 05:07 mrfoxie

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

pinheadmz avatar Jul 21 '20 13:07 pinheadmz

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.

mrfoxie avatar Jul 22 '20 03:07 mrfoxie

I believe standalone has been replaced with umd please read the documentation here: https://github.com/chjj/bpkg

pinheadmz avatar Jul 22 '20 12:07 pinheadmz

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
+ [email protected]
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
+ [email protected]
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 Screenshot (12)

mrfoxie avatar Jul 29 '20 09:07 mrfoxie

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>

Screenshot from 2020-07-29 08-27-14

pinheadmz avatar Jul 29 '20 12:07 pinheadmz

if I add this HD.js script in browser folder and then include it in index.html wull it work

mrfoxie avatar Jul 31 '20 17:07 mrfoxie

yup. i think so :-) That's how this works: https://github.com/pinheadmz/bcoin-webapp

pinheadmz avatar Jul 31 '20 17:07 pinheadmz

its working but there is a question i want to ask can i make like this from this codes https://bcoin.io/browser/

mrfoxie avatar Aug 02 '20 05:08 mrfoxie

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.

pinheadmz avatar Aug 03 '20 15:08 pinheadmz

okay i will check and tell you

mrfoxie avatar Aug 04 '20 12:08 mrfoxie

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.

image as im trying it but i got this error

mrfoxie avatar Aug 21 '20 12:08 mrfoxie