Ride-The-Lightning / c-lightning-REST

REST APIs for Core Lightning written with node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

psychoet opened this issue · comments

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.

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

Thanks for the solution! Now it is running well!