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"
  • 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 Jul 31 '18 at 0:27
  • I'm using npm version 6.1.0 – cory.m.smith Jul 31 '18 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 Aug 1 '18 at 13:12
  • No, just those 2 ├─┬ stellar-hd-wallet@0.0.6 │ └── stellar-base@0.7.8 └─┬ stellar-sdk@0.9.2 └── stellar-base@0.7.8 – cory.m.smith Aug 1 '18 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 Aug 1 '18 at 16:23
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:

js-xdr@1.0.4
stellar-base@0.8.2
stellar-sdk@0.10.2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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