Ride-The-Lightning / c-lightning-REST

REST APIs for Core Lightning written with node.js
MIT License
120 stars 43 forks source link

Can't start c-lightning-REST as API server #180

Closed psychoet closed 1 year ago

psychoet commented 1 year ago

I got stuck in running RTL after I upgrade my CLN to 23.05, so I removed and reinstalled c-lightning-REST and RTL. Even though, it still does not work from c-lightning-REST level.

This is the error message I got when I run node cl-rest.js:

error: WARN: /home/[USR]/.lightning/lightning-rpc is missing, using the bitcoin mainnet subdirectory at /home/[USR]/.lightning/bitcoin instead. /home/[USR]/.lightning/plugins-available/c-lightning-REST/utils/utils.js:3 const currentVersionArr = currentVersion.trim()?.replace('v', '').split('-')[0].split('.') || []; ^

SyntaxError: Unexpected token '.' at wrapSafe (internal/modules/cjs/loader.js:915:16) at Module._compile (internal/modules/cjs/loader.js:963:27) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) at Module.load (internal/modules/cjs/loader.js:863:32) at Function.Module._load (internal/modules/cjs/loader.js:708:14) at Module.require (internal/modules/cjs/loader.js:887:19) at require (internal/modules/cjs/helpers.js:74:18) at Object. (/home/[USR]/.lightning/plugins-available/c-lightning-REST/controllers/getBalance.js:1:33) at Module._compile (internal/modules/cjs/loader.js:999:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)

It would be grateful if you let me know how to fix this.

ShahanaFarooqui commented 1 year ago

This is the error related to incompatible version of nodejs. You need Nodejs >v16 to run c-lightning-rest and RTL.

psychoet commented 1 year ago

Thanks for the solution! Now it is running well!