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 ?

1 Answer 1


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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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