来自package.json:
"ganache-cli": "^6.3.0",
"web3": "^1.0.0-beta.41",在我的createContract.js里
const Web3 = require("web3");
const ganache = require("ganache-cli");
console.log('ganache.provider :', JSON.stringify(ganache));
let web3 = new Web3(new Web3.providers.HttpProvider(ganache.provider()));控制台日志的结果:
ganache.provider : {"_webpacked":true,"version":"2.4.0","to":{}}我的错误:
.../node_modules/web3-providers/dist/web3-providers.cjs.js:99
if (host.substring(0, 5) === 'https') {
^
TypeError: host.substring is not a function对这个错误有什么建议吗?
发布于 2019-02-05 07:46:06
我认为,您可以这样使用ganache提供程序:
const web3 = new Web3(ganache.provider());https://ethereum.stackexchange.com/questions/66632
复制相似问题