1

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:

.../node_modules/web3-providers/dist/web3-providers.cjs.js:99
    if (host.substring(0, 5) === 'https') {
             ^
TypeError: host.substring is not a function

any advice on this error ?

0

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, privacy policy and cookie policy

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