mrfelton / lnd-binary

Install lnd from npm https://github.com/lightningnetwork/lnd ⚡️
MIT License
17 stars 7 forks source link

`install()` fails on node 6 #13

Open OttoAllmendinger opened 6 years ago

OttoAllmendinger commented 6 years ago

With node 8 lts:

$ nvm use lts/carbon
$ rm -r node_modules
$ npm i --save lnd-binary
$ node -e "require('lnd-binary').install()"
# ...
info lnd-binary Moved lnd binary to /home/otto/tmp/node_modules/lnd-binary/vendor/lnd

With node 6 lts:

$ nvm use lts/boron
$ rm -r node_modules
$ npm i --save lnd-binary
$ node -e "require('lnd-binary').install()"
info lnd-binary Downloading https://github.com/lightningnetwork/lnd/releases/download/v0.4.2-beta/lnd-linux-amd64-v0.4.2-beta.tar.gz
info lnd-binary Verified checksum of downloaded file                                                    
info lnd-binary Extracted lnd archive to /tmp/tmp/lnd-downloads-5829ec94                                

/home/otto/tmp/node_modules/lnd-binary/src/lib/extract.js:39                                        
    fs.copyFileSync(downloadedLndBinary, dest)
       ^
TypeError: _fsExtra2.default.copyFileSync is not a function                                             
    at copyFileSync (/home/otto/tmp/node_modules/lnd-binary/src/lib/extract.js:39:8)                
    at Extract.moveToDest (/home/otto/tmp/node_modules/lnd-binary/src/lib/extract.js:54:29)         
    at emitNone (events.js:91:20)
    at Extract.emit (events.js:185:7)
    at finishMaybe (/home/otto/tmp/node_modules/readable-stream/lib/_stream_writable.js:503:14)     
    at afterWrite (/home/otto/tmp/node_modules/readable-stream/lib/_stream_writable.js:385:3)       
    at _combinedTickCallback (internal/process/next_tick.js:86:20)                                      
    at process._tickCallback (internal/process/next_tick.js:104:9)                                      
mrfelton commented 6 years ago

We probably need a polyfill of sorts for copyFileSync in order to support older versions of node