Closed ghost closed 4 years ago
The first errors you were seeing are because the code under src/
has to be compiled with babel first, it cannot be run directly with nodejs. You can either compile it with npm run dist:npm
like you did, or use npm start -- --ln-path ...
to start a dev server with on-the-fly compilation (note that the latter option is slower and a cpu hog).
As for the stuck loading screen, could you open the developer tools (Ctrl-Shift-I) and see if there are any errors there?
If you're seeing t.amount_msat is undefined
, this is a bug that was fixed but still not released.
I apply git clone https://github.com/shesek/spark-wallet
so already use the bug fix.
The npm run dist:npm
also went ok when I first do
npm i nib
npm i pugify
npm i babelify
npm i browserify-package-json
npm i browserify
npm i envify
npm i uglifyify
I did some further research. With a test lightning node (on mainnet not testnet) I removed all transactions (from lightningd.sqlite3
) and spark-wallet 0.2.15 was fine (for that test node without transactions). Then I paid an invoice to my "real" lightning node and that showed up fine in spark-wallet (for the test node). But when I do a keysend transaction with my test node to my "real" node then spark-wallet (for the test node) hangs and I get the following errors in the console of crtl shift i:
Error: Not a proper lightning payment request
decode https://217.104.4.71:9738/app.js:1
_ https://217.104.4.71:9738/app.js:1
parsePayment https://217.104.4.71:9738/app.js:1
it https://217.104.4.71:9738/app.js:1
it https://217.104.4.71:9738/app.js:1
_tryNext https://217.104.4.71:9738/app.js:1
_next https://217.104.4.71:9738/app.js:1
next https://217.104.4.71:9738/app.js:1
notifyNext https://217.104.4.71:9738/app.js:1
_next https://217.104.4.71:9738/app.js:1
next https://217.104.4.71:9738/app.js:1
notifyNext https://217.104.4.71:9738/app.js:1
_next https://217.104.4.71:9738/app.js:1
next https://217.104.4.71:9738/app.js:1
_next https://217.104.4.71:9738/app.js:1
next https://217.104.4.71:9738/app.js:1
_next https://217.104.4.71:9738/app.js:1
next https://217.104.4.71:9738/app.js:1
notifyNext https://217.104.4.71:9738/app.js:1
_next https://217.104.4.71:9738/app.js:1
next https://217.104.4.71:9738/app.js:1
_next https://217.104.4.71:9738/app.js:1
next https://217.104.4.71:9738/app.js:1
_n https://217.104.4.71:9738/app.js:1
_n https://217.104.4.71:9738/app.js:1
_n https://217.104.4.71:9738/app.js:1
start https://217.104.4.71:9738/app.js:1
callback https://217.104.4.71:9738/app.js:1
v https://217.104.4.71:9738/app.js:1
emit https://217.104.4.71:9738/app.js:1
onreadystatechange https://217.104.4.71:9738/app.js:1
The keysend transaction was ok:
lightning-cli keysend 02888244029c5909593038ab19f269947c720de3423e491791b46c7c92f76279b6 10000
{
"destination": "02888244029c5909593038ab19f269947c720de3423e491791b46c7c92f76279b6",
"payment_hash": "1910e222c23342b416e6e15d03015ecf3076ed62b684c1774df897a26347f4ed",
"created_at": 1597086328.275,
"parts": 1,
"msatoshi": 10000,
"amount_msat": "10000msat",
"msatoshi_sent": 10000,
"amount_sent_msat": "10000msat",
"payment_preimage": "377188933ddd25650c8ed06ac2eb6f8a6dc59474051e7375e318e00d46c7a167",
"status": "complete"
}
@sumBTC I sent you a pm on reddit, can we chat there to diagnose this? or is there some other IM that you prefer?
The
npm run dist:npm
also went ok when I first do ...
Installing these dependencies manually should not be required, did you run npm install
before dist:npm
? (the docs were missing this until 20 minutes ago)
I believe this should be fixed by 3eda345d17bb6a2881f2b121c005a9fef618424e, and I also future proofed against other failures to decode the bolt11 in 00266e10de1f914f9e4cdd3ea3b8ba076c3c0490.
Can you give this a try?
Yes, will report back soon
Yes, that solved it!
BTW with
$ git clone https://github.com/shesek/spark-wallet && cd spark-wallet
$ npm install
$ npm run dist:npm
I still get:
stylus -u nib -c styl/style.styl -o ../dist/www
internal/modules/cjs/loader.js:968
throw err;
^
Error: Cannot find module 'nib'
Require stack:
- /usr/lib/node_modules/stylus/bin/stylus
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
at Function.Module._load (internal/modules/cjs/loader.js:841:27)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at /usr/lib/node_modules/stylus/bin/stylus:795:10
at Array.forEach (<anonymous>)
at usePlugins (/usr/lib/node_modules/stylus/bin/stylus:792:11)
at /usr/lib/node_modules/stylus/bin/stylus:653:9
at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:63:3) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/usr/lib/node_modules/stylus/bin/stylus' ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! spark-client@ dist: `./build.sh`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the spark-client@ dist script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/user/.npm/_logs/2020-08-10T19_53_33_007Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! spark-wallet@0.2.15 dist:npm: `./scripts/build.sh`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the spark-wallet@0.2.15 dist:npm script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/user/.npm/_logs/2020-08-10T19_53_33_140Z-debug.log
But if I install all those modules as above all is fine.
@sumBTC try this
$ git clone https://github.com/shesek/spark-wallet && cd spark-wallet && npm install
$ cd client/fonts && npm install
$ cd .. && npm install && ./fonts/rewrite-css.sh node_modules/bootswatch/dist/*/*.min.css
$ cd .. && npm run dist:npm
$ ./dist/cli.js --ln-path ~/.lightning/bitcoin
@gruve-p @sumBTC Just running npm install
inside the client
directory should be sufficient to resolve this.
But this should not be necessary, the dist:npm
script is supposed to do automatically, I'll look into why its not. Opened #152 to track this.
npm WARN lifecycle spark-client@~postinstall: cannot run in wd spark-client@ (cd fonts && npm install) && ./fonts/rewrite-css.sh node_modules/bootswatch/dist/*/*.min.css (wd=/root/spark-wallet/client)
added 169 packages from 193 contributors in 27.129s
6 packages are looking for funding
run `npm fund` for details
+ cp -r www/favicon.ico www/manifest www/notification.png www/style.css ../dist/www/
+ cp -r 'fonts/node_modules/typeface-*' ../dist/www/fonts/
cp: cannot stat 'fonts/node_modules/typeface-*': No such file or directory
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! spark-client@ dist: `./build.sh`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the spark-client@ dist script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-08-10T20_59_19_265Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! spark-wallet@0.2.15 dist:npm: `./scripts/build.sh`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the spark-wallet@0.2.15 dist:npm script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-08-10T20_59_19_284Z-debug.log
@gruve-p That worked. Maybe that gives some extra information to @shesek
So:
$ git clone https://github.com/shesek/spark-wallet && cd spark-wallet && npm install
$ cd client/fonts && npm install
$ cd .. && npm install && ./fonts/rewrite-css.sh node_modules/bootswatch/dist/*/*.min.css
$ cd .. && npm run dist:npm
and then running spark-wallet as usual (./dist/cli.js
) worked
@sumBTC Have you tried with a simple npm install
within the client
directory? Did it not work?
@gruve-p I think the reason a simple npm install
in the client
directory didn't work for you is that you're running as root, which npm doesn't typically like. Can you try with npm install --unsafe-perm
and see if that works?
Yes I did and it didn't work (sorry I should have mentioned that).
Doing:
git clone https://github.com/shesek/spark-wallet
cd spark-wallet
npm install
npm run dist:npm
gives as output:
Cloning into 'spark-wallet'...
remote: Enumerating objects: 164, done.
remote: Counting objects: 100% (164/164), done.
remote: Compressing objects: 100% (85/85), done.
remote: Total 4578 (delta 97), reused 132 (delta 79), pack-reused 4414
Receiving objects: 100% (4578/4578), 9.48 MiB | 8.04 MiB/s, done.
Resolving deltas: 100% (3375/3375), done.
> core-js@2.6.11 postinstall /home/user/spark-wallet/node_modules/@babel/polyfill/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock
Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
> core-js@3.6.5 postinstall /home/user/spark-wallet/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (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":"x64"})
added 580 packages from 269 contributors and audited 583 packages in 45.637s
20 packages are looking for funding
run `npm fund` for details
found 3 vulnerabilities (1 low, 2 moderate)
run `npm audit fix` to fix them, or `npm audit` for details
> spark-wallet@0.2.15 dist:npm /home/user/spark-wallet
> ./scripts/build.sh
+ mkdir -p dist
+ rm -rf 'dist/*'
+ babel -d dist --ignore src/transport/granax-dep/node_modules src
Successfully compiled 11 files with Babel (4518ms).
+ cp src/transport/granax-dep/package.json src/transport/granax-dep/npm-shrinkwrap.json dist/transport/granax-dep/
+ cd client
+ DEST=../dist/www
+ npm run dist
> spark-client@ dist /home/user/spark-wallet/client
> ./build.sh
+ shopt -s extglob
+ : ../dist/www
+ : production
+ : web
+ export BUILD_TARGET
+ export NODE_ENV
++ node -p 'require("../package").version'
+ export VERSION=0.2.15
+ VERSION=0.2.15
+ rm -rf '../dist/www/*'
+ mkdir -p ../dist/www ../dist/www/lib ../dist/www/fonts ../dist/www/swatch
+ [[ -d node_modules ]]
+ npm install
> secp256k1@3.8.0 install /home/user/spark-wallet/client/node_modules/secp256k1
> npm run rebuild || echo "Secp256k1 bindings compilation fail. Pure JS implementation will be used."
> secp256k1@3.8.0 rebuild /home/user/spark-wallet/client/node_modules/secp256k1
> node-gyp rebuild
make: Entering directory '/home/user/spark-wallet/client/node_modules/secp256k1/build'
CXX(target) Release/obj.target/secp256k1/src/addon.o
CXX(target) Release/obj.target/secp256k1/src/privatekey.o
../src/privatekey.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE privateKeyNegate(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/privatekey.cc:73:30: warning: ignoring return value of ‘int secp256k1_ec_privkey_negate(const secp256k1_context*, unsigned char*)’, declared with attribute warn_unused_result [-Wunused-result]
secp256k1_ec_privkey_negate(secp256k1ctx, &private_key[0]);
~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CXX(target) Release/obj.target/secp256k1/src/publickey.o
CXX(target) Release/obj.target/secp256k1/src/signature.o
CXX(target) Release/obj.target/secp256k1/src/ecdsa.o
../src/ecdsa.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE sign(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/ecdsa.cc:88:131: warning: ignoring return value of ‘v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)’, declared with attribute warn_unused_result [-Wunused-result]
(), Nan::New<v8::String>("signature").ToLocalChecked(), COPY_BUFFER(&output[0], 64));
^
In file included from /home/user/.cache/node-gyp/12.18.3/include/node/node.h:67:0,
from ../src/ecdsa.cc:1:
/home/user/.cache/node-gyp/12.18.3/include/node/v8.h:3504:37: note: declared here
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^~~
../src/ecdsa.cc:89:130: warning: ignoring return value of ‘v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)’, declared with attribute warn_unused_result [-Wunused-result]
t(), Nan::New<v8::String>("recovery").ToLocalChecked(), Nan::New<v8::Number>(recid));
^
In file included from /home/user/.cache/node-gyp/12.18.3/include/node/node.h:67:0,
from ../src/ecdsa.cc:1:
/home/user/.cache/node-gyp/12.18.3/include/node/v8.h:3504:37: note: declared here
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^~~
CXX(target) Release/obj.target/secp256k1/src/ecdh.o
CC(target) Release/obj.target/secp256k1/src/secp256k1-src/src/secp256k1.o
CC(target) Release/obj.target/secp256k1/src/secp256k1-src/contrib/lax_der_parsing.o
CC(target) Release/obj.target/secp256k1/src/secp256k1-src/contrib/lax_der_privatekey_parsing.o
SOLINK_MODULE(target) Release/obj.target/secp256k1.node
COPY Release/secp256k1.node
make: Leaving directory '/home/user/spark-wallet/client/node_modules/secp256k1/build'
> spark-client@ postinstall /home/user/spark-wallet/client
> (cd fonts && npm install) && ./fonts/rewrite-css.sh node_modules/bootswatch/dist/*/*.min.css
added 6 packages from 1 contributor and audited 6 packages in 0.861s
found 0 vulnerabilities
added 164 packages from 192 contributors and audited 789 packages in 66.213s
7 packages are looking for funding
run `npm fund` for details
found 117 low severity vulnerabilities
run `npm audit fix` to fix them, or `npm audit` for details
+ cp -r www/favicon.ico www/manifest www/notification.png ../dist/www/
+ cp -r fonts/node_modules/typeface-lato fonts/node_modules/typeface-nunito-sans fonts/node_modules/typeface-open-sans fonts/node_modules/typeface-roboto fonts/node_modules/typeface-source-sans-pro fonts/node_modules/typeface-ubuntu ../dist/www/fonts/
+ cp -r node_modules/bootswatch/dist/cerulean node_modules/bootswatch/dist/cosmo node_modules/bootswatch/dist/cyborg node_modules/bootswatch/dist/flatly node_modules/bootswatch/dist/lumen node_modules/bootswatch/dist/lux node_modules/bootswatch/dist/materia node_modules/bootswatch/dist/sandstone node_modules/bootswatch/dist/simplex node_modules/bootswatch/dist/slate node_modules/bootswatch/dist/solar node_modules/bootswatch/dist/spacelab node_modules/bootswatch/dist/superhero node_modules/bootswatch/dist/united node_modules/bootswatch/dist/yeti ../dist/www/swatch/
+ cp -r swatch/dark/ ../dist/www/swatch/
+ find ../dist/www/swatch -type f '!' -name '*.min.css' -delete
+ find ../dist/www/fonts -type f -regex '.*\.\(md\|json\)' -delete
+ ./fonts/rewrite-css.sh ../dist/www/swatch/cerulean/bootstrap.min.css ../dist/www/swatch/cosmo/bootstrap.min.css ../dist/www/swatch/cyborg/bootstrap.min.css ../dist/www/swatch/dark/bootstrap.min.css ../dist/www/swatch/flatly/bootstrap.min.css ../dist/www/swatch/lumen/bootstrap.min.css ../dist/www/swatch/lux/bootstrap.min.css ../dist/www/swatch/materia/bootstrap.min.css ../dist/www/swatch/sandstone/bootstrap.min.css ../dist/www/swatch/simplex/bootstrap.min.css ../dist/www/swatch/slate/bootstrap.min.css ../dist/www/swatch/solar/bootstrap.min.css ../dist/www/swatch/spacelab/bootstrap.min.css ../dist/www/swatch/superhero/bootstrap.min.css ../dist/www/swatch/united/bootstrap.min.css ../dist/www/swatch/yeti/bootstrap.min.css
+ [[ web == \w\e\b ]]
+ cp node_modules/instascan/dist/instascan.min.js ../dist/www/lib/instascan.js
+ [[ web != \w\e\b ]]
+ pug index.pug -o ../dist/www
rendered /home/user/spark-wallet/dist/www/index.html
+ stylus -u nib -c styl/style.styl -o ../dist/www
internal/modules/cjs/loader.js:968
throw err;
^
Error: Cannot find module 'nib'
Require stack:
- /usr/lib/node_modules/stylus/bin/stylus
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
at Function.Module._load (internal/modules/cjs/loader.js:841:27)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at /usr/lib/node_modules/stylus/bin/stylus:795:10
at Array.forEach (<anonymous>)
at usePlugins (/usr/lib/node_modules/stylus/bin/stylus:792:11)
at /usr/lib/node_modules/stylus/bin/stylus:653:9
at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:63:3) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/usr/lib/node_modules/stylus/bin/stylus' ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! spark-client@ dist: `./build.sh`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the spark-client@ dist script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/user/.npm/_logs/2020-08-11T05_59_02_652Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! spark-wallet@0.2.15 dist:npm: `./scripts/build.sh`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the spark-wallet@0.2.15 dist:npm script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/user/.npm/_logs/2020-08-11T05_59_02_750Z-debug.log
@sumBTC Note that my suggestion was to run npm install
inside the client
subdirectory, in addition to the main directory.
Again, this should not be necessary and I will be working on a fix such that npm install
in the main directory is sufficient, but in the meanwhile cd client && npm install
should make it work, without manually installing the dependencies like @gruve-p suggested.
@shesek Oh haha I thought with client directory you meant the main directory of the client. So, yeah, this worked great:
git clone https://github.com/shesek/spark-wallet
cd spark-wallet/client
npm install
cd ..
npm install
npm run dist:npm
Great, thanks for confirming!
@sumBTC @gruve-p I fixed the installation bug in 0553b8706ff9946d9e22b5c05b209561994f6c29, it should now work as documented on the README.
@shesek It does! Well done. So everything is fine now. I will keep an eye on the changes at c-lightning and spark-wallet and pull
the latest versions when necessary.
@shesek I can confirm the installation bug is now fixed
Got it working in that it shows number of sats. Got an error message about the ...p in
src/cmd.js
and removed those ... (no idea what that means) but now 0.2.15 works in that it shows the green sats but not the red once. So, not good but that's more or less where the problem is. The error message:there's another ...p
Spark-wallet version 0.2.14 is working for me, 0.2.15 is not: colored lines keep running around in circles. I'm running spark-wallet inside a browser (Chrome) on Android (version 9).
EDIT: is
nodejs v8
still recommended?EDIT: reinstalled npm and got a little further without errors with
npm run dist:npm
and runningspark-wallet/dist/cli.js
but the result is the same running around circles. Here is the new0.2.15
output:0.2.15
output:0.2.14
output: