sigillabs / mobidex

Mobile trustless trading through Uniswap
https://mobidex.io
GNU Affero General Public License v3.0
75 stars 36 forks source link

NPM install breaks #234

Closed generalpiston closed 5 years ago

pixelmatrix commented 5 years ago

So I experienced this issue when downloading the repo and installing from scratch.

Upon running npm install at the root of the package I would see errors like this:

gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:189:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Darwin 18.6.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/jp/Downloads/web3-contracts-loader-master/node_modules/sha3
gyp ERR! node -v v10.15.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sha3@1.2.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sha3@1.2.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

After the process of elimination, I found that it was due to the web3-contracts-loader git module, so I downloaded it locally to investigate.

Sure enough, running npm install caused the same failure.

Next, I went into package.json and updated the web3 dependency to only point at the beta version (right side of the || operator).

After running npm install again, I saw a new error with typescript this time:

node_modules/web3-eth/types/index.d.ts(147,59): error TS1122: A tuple type element list cannot be empty.

147     pendingTransactions(callback?: (error: Error, result: []) => void): Promise<[]>;
                                                              ~~

node_modules/web3-eth/types/index.d.ts(147,81): error TS1122: A tuple type element list cannot be empty.

147     pendingTransactions(callback?: (error: Error, result: []) => void): Promise<[]>;

I noticed this was complaining about the typings from web3, and nothing in this repo. I also noticed the specific version of web3 installed was fairly outdated, so I bumped it to the a more modern version, hoping the typings were improved so that the package could build.

npm install web3@1.0.0-beta.33

Once I did that, the web3-contracts-loader package was building fine locally, so I moved the entire directory into the mobidex node_modules directory, and the app worked fine from that point on.

pixelmatrix commented 5 years ago

My assumption is that updating the web3 dependency in web3-contracts-loader would solve the issue, but I'm not sure if there are other implications there.

generalpiston commented 5 years ago

Makes sense @pixelmatrix . We may need to fix generalpiston/web3-contracts-loader .

generalpiston commented 5 years ago

It looks like 1.0.0-beta.55 is being installed by default. We should enforce 1.0.0-beta.21 is being used.

generalpiston commented 5 years ago

Fixed in https://github.com/generalpiston/web3-contracts-loader/commit/97e5a1d38c8eeef1adae459c1176b154d0d7d537

generalpiston commented 5 years ago

Thank you @pixelmatrix for finding and helping us figure out this bug!