chia-repl
chia-repl copied to clipboard
[BUG] Doesn't work with Node v18. Error while loading BLS module
Receiving "Error while loading BLS module" when starting chia-repl after installation from source
Followed the steps in the https://github.com/dkackman/chia-repl#from-source with a clean clone of the repository, but received the following error:
> [email protected] start
> node index.js
Error while loading BLS module
/home/leonid/dev/nodejs/chia-repl/node_modules/@chiamine/bls-signatures/blsjs.js:11
if(ia)w=v?require("path").dirname(w)+"/":__dirname+"/",ka=function(a,b){na||(na=require("fs"));oa||(oa=require("path"));a=oa.normalize(a);return na.readFileSync(a,b?null:"utf8")},ma=function(a){a=ka(a,!0);a.buffer||(a=new Uint8Array(a));assert(a.buffer);return a},1<process.argv.length&&(fa=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",function(a){throw a;}),process.on("unhandledRejection",x),h.inspect=function(){return"[Emscripten Module object]"};else if(ja)"undefined"!=
^
TypeError: Failed to parse URL from /home/leonid/dev/nodejs/chia-repl/node_modules/@chiamine/bls-signatures/blsjs.wasm
at new Request (node:internal/deps/undici/undici:5446:19)
at Agent.fetch2 (node:internal/deps/undici/undici:6242:25)
... 4 lines matching cause stack trace ...
at /home/leonid/dev/nodejs/chia-repl/node_modules/@chiamine/bls-signatures/blsjs.js:111:149
at /home/leonid/dev/nodejs/chia-repl/node_modules/clvm_tools/node_modules/clvm/__bls_signatures__/index.js:31:13
at new Promise (<anonymous>)
at Object.<anonymous> (/home/leonid/dev/nodejs/chia-repl/node_modules/clvm_tools/node_modules/clvm/__bls_signatures__/index.js:26:38) {
[cause]: TypeError [ERR_INVALID_URL]: Invalid URL
at new NodeError (node:internal/errors:387:5)
at URL.onParseError (node:internal/url:564:9)
at new URL (node:internal/url:644:5)
at new Request (node:internal/deps/undici/undici:5444:25)
at Agent.fetch2 (node:internal/deps/undici/undici:6242:25)
at Object.fetch (node:internal/deps/undici/undici:7076:20)
at fetch (node:internal/bootstrap/pre_execution:199:25)
at /home/leonid/dev/nodejs/chia-repl/node_modules/@chiamine/bls-signatures/blsjs.js:110:422
at /home/leonid/dev/nodejs/chia-repl/node_modules/@chiamine/bls-signatures/blsjs.js:111:126
at /home/leonid/dev/nodejs/chia-repl/node_modules/@chiamine/bls-signatures/blsjs.js:111:149 {
input: '/home/leonid/dev/nodejs/chia-repl/node_modules/@chiamine/bls-signatures/blsjs.wasm',
code: 'ERR_INVALID_URL'
}
}
Node.js v18.7.0
npm ERR! Lifecycle script `start` failed with error:
npm ERR! Error: command failed
npm ERR! in workspace: [email protected]
npm ERR! at location: /home/leonid/dev/nodejs/chia-repl/packages/chia-repl
leonid@asus:~/dev/nodejs/chia-repl$
To Reproduce Steps to reproduce the behavior:
- Install NodeJS on Ubuntu 20.04 as explained in the https://github.com/nodesource/distributions/blob/master/README.md#debinstall
- git clone https://github.com/dkackman/chia-repl.git && cd chia-repl
- npm install
- npm start -w chia-repl
Expected behavior Expected to get chia-repl prompt
Screenshot
Server (laptop):
- OS: Ubuntu 20.04
- NodeJS: v18.7.0
- NPM: 8.15.0
- Chia version: 1.5.0
This is almost certainly because of node 18. I'll take a look but any chance you can use node 16 lts in the meantime?
Thank you for the prompt response!
Yes, I removed node 18 and installed node 16 and that fixed the issue:
leonid@asus:~$ node --version
v16.16.0
leonid@asus:~$ npm --version
8.11.0
leonid@asus:~$ whereis node
node: /usr/bin/node /usr/include/node /usr/share/man/man1/node.1.gz
leonid@asus:~$ whereis npm
npm: /usr/bin/npm
leonid@asus:~$
leonid@asus:~/dev/nodejs/chia-repl$ npm start -w chia-repl
> [email protected] start
> node index.js
🌿 Welcome to Chia!
Type .help or .more-help to get started
Current connection address is wss://localhost:55400
🌿
Closing the issue as the original problem was resolved.