web3c.js
web3c.js copied to clipboard
web3.js@beta38 breaks web3c
Steps to reproduce:
npm install web3cin a fresh workspace- run the following file
let Web3c = require('web3c');
let web3c = new Web3c();
This yields the following error:
Error: Cannot find module '@babel/runtime/helpers/classCallCheck'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/armaniferrante/Documents/code/src/github.com/oasislabs/hi/node_modules/web3/dist/web3.cjs.js:5:39)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
Note that we can fix this by adding @babel/runtime as a dependency. Doing that, then yields a new error:
throw new TypeError("Cannot call a class as a function");
^
TypeError: Cannot call a class as a function
at _classCallCheck (/Users/armaniferrante/Documents/code/src/github.com/oasislabs/hi/node_modules/@babel/runtime/helpers/classCallCheck.js:3:11)
at module.exports.Web3 (/Users/armaniferrante/Documents/code/src/github.com/oasislabs/hi/node_modules/web3/dist/web3.cjs.js:29:5)
at new module.exports (/Users/armaniferrante/Documents/code/src/github.com/oasislabs/hi/node_modules/web3c/index.node.js:12:8)
at Object.<anonymous> (/Users/armaniferrante/Documents/code/src/github.com/oasislabs/hi/hi.js:3:11)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
at Function.Module.runMain (module.js:701:10)
at startup (bootstrap_node.js:194:16)
at bootstrap_node.js:618:3
which is caused by the following line https://github.com/oasislabs/web3c.js/blob/master/index.node.js#L12
looks like they've refactored quite a bit. no concept of request manager anymore. i'll take a look at what needs to change.
Depending upon how much work this is, we can pin the web3 dependency in the meantime to beta@37 by hacking the package-lock.json.
eventually we'll need to support the newer setup in recognition that a non-beta web3 will come out eventually :)
On Sun, Jan 27, 2019 at 8:27 PM Armani Ferrante [email protected] wrote:
Depending upon how much work this is, we can pin the web3 dependency in the meantime to beta@37 by hacking the package-lock.json.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/oasislabs/web3c.js/issues/113#issuecomment-457995614, or mute the thread https://github.com/notifications/unsubscribe-auth/AAaIp_ypnbvaVoxSSfI7SLW-WrkHJpNTks5vHnw8gaJpZM4aUkL4 .
better pinned in v1.0.4 as a temporary bandaid
web3c is up to beta 46. api doesn't appear to be breaking too much in the couple recent updates
Is there any progress on this issue? I have the same error for var version = "1.0.0-beta.48"; (injected via window.ethereum). Should I not use Metamask's injected web3 for web3c?
For future reference: This issue was caused due to soft dep in webpack. A hard dep in package.json to 1.0.0-beta.37 solved it for now.