Trying to run npx hardhat run --network ropsten scripts/deploy.ts
deploy.ts
throws a type error
import { ethers } from "ethers";
// const hre = require("hardhat");
async function main() {
// await hre.run('compile');
const Greeter = await ethers.getContractFactory("Greeter")
const greeter = await Greeter.deploy("Hello, Hardhat!")
await greeter.deployed()
console.log("Greeter deployed to:", greeter.address)
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error)
process.exit(1)
});
Property 'getContractFactory' does not exist on type 'typeof import("/home/ubuntu/demos/react-dapp/node_modules/ethers/lib/ethers")'.
Throws an error when hre
gets removed from const Greeter = await hre.ethers.getContractFactory("Greeter")
to await ethers.getContractFactory("Greeter")
source code: https://github.com/GoGetterMeme/react_dapp.git