3

When I include both stellar-hd-wallet and stellar-sdk in my project I get errors when requiring them both as stellar-base is included twice which also imports the generated XDR types twice causing the below error.

Any suggestions?

Error: XDR Error:Value is already defined
    at TypeBuilder.define (/code/blockchain-client/node_modules/js-xdr/lib/config.js:341:17)
    at TypeBuilder.typedef (/code/blockchain-client/node_modules/js-xdr/lib/config.js:247:14)
    at /code/blockchain-client/node_modules/stellar-hd-wallet/node_modules/stellar-base/lib/generated/stellar-xdr_generated.js:1:259
    at Object.config (/code/blockchain-client/node_modules/js-xdr/lib/config.js:38:5)
    at Object.<anonymous> (//code/blockchain-client/node_modules/stellar-hd-wallet/node_modules/stellar-base/lib/generated/stellar-xdr_generated.js:1:234)

These are the related deps in my package.json:

"stellar-hd-wallet": "0.0.6",
"stellar-sdk": "^0.9.2"
6
  • What version of NPM or Yarn are you using? Both packages specify the same version of stellar-base so your package manager should be able to dedupe it for you.
    – Paul
    Commented Jul 31, 2018 at 0:27
  • I'm using npm version 6.1.0
    – Smixx
    Commented Jul 31, 2018 at 20:08
  • Is there anything else that installs stellar-base besides stellar-hd-wallet or stellar-sdk? It looks like stellar-base is not getting deduped by npm since I see that it's under /node_modules/stellar-hd-wallet/node_modules/stellar-base and it should just be under /node_modules/stellar-base if there's no package conflicts. Can you try running npm ls to see if stellar-base is included by something else?
    – Paul
    Commented Aug 1, 2018 at 13:12
  • No, just those 2 ├─┬ [email protected] │ └── [email protected] └─┬ [email protected] └── [email protected]
    – Smixx
    Commented Aug 1, 2018 at 16:00
  • This should happen automatically, but can you run npm dedupe to see if that helps. Or delete node_modules folder and npm install again.
    – Paul
    Commented Aug 1, 2018 at 16:23

1 Answer 1

3

I know that you got the answer on github, but for anyone else looking I'll link it here: https://github.com/stellar/js-stellar-sdk/issues/191

This is fixed in:

[email protected]
[email protected]
[email protected]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.