from package.json:

"ganache-cli": "^6.3.0",
"web3": "^1.0.0-beta.41",

in my 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()));

the result of the console log:

ganache.provider : {"_webpacked":true,"version":"2.4.0","to":{}}

my error:

    if (host.substring(0, 5) === 'https') {
TypeError: host.substring is not a function

any advice on this error ?


I think, you can use the ganache provider like this:

const web3 = new Web3(ganache.provider());

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.