0

This is the following error I get when running the command "npx hardhat --network localhost scripts/1_deploy.js"


HeadersTimeoutError: Headers Timeout Error
    at Timeout.onParserTimeout [as _onTimeout] (/mnt/g/ONLINE_COURSE/project/blockchain-developer-bootcamp/node_modules/undici/lib/client.js:902:28)
    at listOnTimeout (node:internal/timers:561:11)
    at processTimers (node:internal/timers:502:7) {
  code: 'UND_ERR_HEADERS_TIMEOUT'
}

I dont know the fix to this Kindly help.

The script I'm trying to run

// Fetch contract to deploy
  const Token = await ethers.getContractFactory('Token')
  const Exchange = await ethers.getContractFactory('Exchange')

  // Fetch accounts
  const accounts = await ethers.getSigners()

  console.log(`Accounts fetched:\n${accounts[0].address}\n${accounts[1].address}\n`)

  // Deploy contracts
  const edge = await Token.deploy('EDGE University', 'EDGE', '1000000')
  await edge.deployed()
  console.log(`EDGE Deployed to: ${edge.address}`)

  const mETH = await Token.deploy('mETH', 'mETH', '1000000')
  await mETH.deployed()
  console.log(`mETH Deployed to: ${mETH.address}`)

  const mDAI = await Token.deploy('mDAI', 'mDAI', '1000000')
  await mDAI.deployed()
  console.log(`mDAI Deployed to: ${mDAI.address}`)

  const exchange = await Exchange.deploy(accounts[1].address, 10)
  await exchange.deployed()
  console.log(`Exchange Deployed to: ${exchange.address}`)
}

main()
  .then(() => process.exit(0))
  .catch((error) => {
    console.error(error);
    process.exit(1);
  });

Also I'm using chai matchers....

2
  • That was my first thought, you don't have node running Jan 25, 2023 at 5:26
  • @AlwinTomy You should add that as answer so we could mark the question as resolved.
    – Ismael
    Jan 27, 2023 at 14:59

1 Answer 1

1

I solved it. Such a silly mistake by me ,after running "npx hardhat node", I would stop running it .It works now

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.