Getting error when including bitcore-explorers


(Hrach ) #1

I get error when I am trying to request wallet balance utxos
Error: More than one instance of bitcore-lib found. Please make sure to require bitcore-lib and check that submodules do not also include their own bitcore-lib dependency.

here is my code

    var bitcore = require("bitcore-lib")
    var explorers = require('bitcore-explorers');

     //this part works as long as bitcoin-explorers is not included
       var privateKey = new bitcore.PrivateKey('testnet');
        var publicKey = privateKey.publicKey;
        var address = publicKey.toAddress();

 let client = new explorers.Insight();
 client.getUnspentUtxos('mgZsaffMAow9TR21BQHY9HfTdbPdJFkww2', function(err, utxos) {
    UTXOs = utxos;
    res.json({
        'UTXOs': utxos
        'request_id':request_id,
        'balance':utxos
    });
});

//method returns empty object when I comment out require bitore-lib

at the top but I can see test satoshis in this address here https://live.blockcypher.com/btc-testnet/address/mgZsaffMAow9TR21BQHY9HfTdbPdJFkww2/
How I can get balance with node js and not conflict bitcoin-core ?