Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

npm install 0x.js delivers a broken 0x.js (node) #1214

Closed
yonilevy opened this issue Nov 6, 2018 · 4 comments
Closed

npm install 0x.js delivers a broken 0x.js (node) #1214

yonilevy opened this issue Nov 6, 2018 · 4 comments
Assignees

Comments

@yonilevy
Copy link

yonilevy commented Nov 6, 2018

Expected Behavior

This should not throw an exception:

> npm install 0x.js
> node -p "require('0x.js')"

Current Behavior

> mkdir fun
> cd fun
> npm install 0x.js
> node -p "require('0x.js')"
/tmp/fun/node_modules/@ledgerhq/hw-transport-u2f/lib/TransportU2F.js:120
      var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_) {
                                                 ^

ReferenceError: regeneratorRuntime is not defined
    at /tmp/fun/node_modules/@ledgerhq/hw-transport-u2f/lib/TransportU2F.js:120:50
    at /tmp/fun/node_modules/@ledgerhq/hw-transport-u2f/lib/TransportU2F.js:142:6
    at Object.<anonymous> (/tmp/fun/node_modules/@ledgerhq/hw-transport-u2f/lib/TransportU2F.js:228:2)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)

Possible Solution

This seems like a @ledgerhq/hw-transport-u2f assumption on babel being present...

Environment

Tested on 0x.js versions 2.0.0, 1.0.8
Node v8.11.3
npm 6.4.1
MacOs 10.14.1

@dekz
Copy link
Member

dekz commented Nov 7, 2018

Looks like there has been some recent changes to the ledger library see LedgerHQ/ledgerjs#228.

npm install babel-polyfill 0x.js
node -p "require('babel-polyfill'); require('0x.js')"

If you do not require every package (and dependencies) brought in via 0x.js you can import the individual packages and use those. E.g

@0x/order-utils
@0x/contract-wrappers

It's nice to have a top level package which includes the most used utils (0x.js) but can result in some unexpected dependencies (and errors when they change).

@dekz
Copy link
Member

dekz commented Nov 9, 2018

We're going to lock the version down to the previous release which kept the babel runtime.

Then figure out the best course of action moving forward.

@yonilevy
Copy link
Author

yonilevy commented Nov 9, 2018

👍 Great, that was my workaround as well.
Regardless, I'll take your advice and try to switch to a more specific 0x dependency.

@dekz
Copy link
Member

dekz commented Nov 9, 2018

Published 0x.js 2.0.1. Thanks for making us aware of the issue @yonilevy.

fun λ cat package-lock.json| head -n 7
{
  "requires": true,
  "lockfileVersion": 1,
  "dependencies": {
    "0x.js": {
      "version": "2.0.1",
      "resolved": "https://registry.npmjs.org/0x.js/-/0x.js-2.0.1.tgz",
fun λ node -p "require('0x.js')" | head -n 5
{ assetDataUtils:
   { encodeERC20AssetData: [Function: encodeERC20AssetData],
     decodeERC20AssetData: [Function: decodeERC20AssetData],
     encodeERC721AssetData: [Function: encodeERC721AssetData],
     decodeERC721AssetData: [Function: decodeERC721AssetData],

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants