BitGo/BitGoJS

Can't start the BitGoJS SDK installed from npm

Closed this issue · 5 comments

using:

node -v6.9.5
npm - 3.10.10

installed "bitgo": "^4.27.0", via npm i -S bitgo;

trying to run AUTHENTICATION from https://platform.bitgo.com/bitgojs/

building my project with webpack v3 + babel:

options: {
    presets: ['es2015', 'react', 'stage-0', 'env'],
    plugins: ['transform-class-properties'],
},

so when I'm trying to build the project I get lots of dependencies WARNINGS/ERRORS:

WARNING in ./node_modules/ws/lib/BufferUtil.js
Module not found: Error: Can't resolve 'bufferutil' in '/Users/maxefi/web/distillery/coins-wallet/node_modules/ws/lib'
 @ ./node_modules/ws/lib/BufferUtil.js 35:21-42
 @ ./node_modules/ws/lib/Sender.js
 @ ./node_modules/ws/index.js
 @ ./node_modules/ripple-lib/dist/npm/common/connection.js
 @ ./node_modules/ripple-lib/dist/npm/common/index.js
 @ ./node_modules/ripple-lib/dist/npm/api.js
 @ ./node_modules/ripple-lib/dist/npm/index.js
 @ ./node_modules/bitgo/src/ripple.js
 @ ./node_modules/bitgo/src/v2/coins/xrp.js
 @ ./node_modules/bitgo/src/v2/baseCoin.js
 @ ./node_modules/bitgo/src/bitgo.js
 @ ./node_modules/bitgo/src/index.js
 @ ./services/authentication.js
 @ ./index.js

WARNING in ./node_modules/ws/lib/Validation.js
Module not found: Error: Can't resolve 'utf-8-validate' in '/Users/maxefi/web/distillery/coins-wallet/node_modules/ws/lib'
 @ ./node_modules/ws/lib/Validation.js 10:22-47
 @ ./node_modules/ws/lib/Receiver.js
 @ ./node_modules/ws/index.js
 @ ./node_modules/ripple-lib/dist/npm/common/connection.js
 @ ./node_modules/ripple-lib/dist/npm/common/index.js
 @ ./node_modules/ripple-lib/dist/npm/api.js
 @ ./node_modules/ripple-lib/dist/npm/index.js
 @ ./node_modules/bitgo/src/ripple.js
 @ ./node_modules/bitgo/src/v2/coins/xrp.js
 @ ./node_modules/bitgo/src/v2/baseCoin.js
 @ ./node_modules/bitgo/src/bitgo.js
 @ ./node_modules/bitgo/src/index.js
 @ ./services/authentication.js
 @ ./index.js

ERROR in ./node_modules/pac-resolver/dnsResolve.js
Module not found: Error: Can't resolve 'dns' in '/Users/maxefi/web/distillery/coins-wallet/node_modules/pac-resolver'
 @ ./node_modules/pac-resolver/dnsResolve.js 6:10-24
 @ ./node_modules/pac-resolver/index.js
 @ ./node_modules/pac-proxy-agent/index.js
 @ ./node_modules/proxy-agent/index.js
 @ ./node_modules/superagent-proxy/index.js
 @ ./node_modules/bitgo/src/bitgo.js
 @ ./node_modules/bitgo/src/index.js
 @ ./services/authentication.js
 @ ./index.js

ERROR in ./node_modules/pac-resolver/isResolvable.js
Module not found: Error: Can't resolve 'dns' in '/Users/maxefi/web/distillery/coins-wallet/node_modules/pac-resolver'
 @ ./node_modules/pac-resolver/isResolvable.js 6:10-24
 @ ./node_modules/pac-resolver/index.js
 @ ./node_modules/pac-proxy-agent/index.js
 @ ./node_modules/proxy-agent/index.js
 @ ./node_modules/superagent-proxy/index.js
 @ ./node_modules/bitgo/src/bitgo.js
 @ ./node_modules/bitgo/src/index.js
 @ ./services/authentication.js
 @ ./index.js

@maxefi Is this still happening? If yes, could you please share instructions on how to reproduce?

@LeoKotschenreuther hello there, a little too much time has passed and it's a bit outdated, but yes, this is still happening.
steps to reproduce:

  • clone this repo;
  • switch to sdk branch;
  • npm i;
  • npm run build;

You'll need to create the browser bundle with npm run compile and then include the resulting js file in build/BitGoJS.min.js.

Hi, I'm facing a similar list of errors/compilation failures. I get a smaller list using BitGoJS.js instead of min, but the same issues overall, mainly 'Cannot find module "dns"' and

  Line 4:   'define' is not defined   no-undef
  Line 5:   'define' is not defined   no-undef
  Line 10:  Unexpected use of 'self'  no-restricted-globals
  Line 10:  Unexpected use of 'self'  no-restricted-globals```

@allegramarie, I have created a small example project which shows how to build and include BitGoJS in a browser environment: https://github.com/BitGo/bitgo-browser-example

This information will also be added to the project README file.

Please take a look, and let me know if you have any further issues or questions. Thanks!