所以当我想部署我的合约并编写"npx hardhat运行scripts/deploy.js——network goerli"但是它给出了一个错误,说:
HardhatError: HH700: Artifact for contract;HelloWorld"没有找到。在工件。_handleWrongArtifactForContractName(/用户//hello -世界/node_modules/建筑工人/src/内部/artifacts.ts: 702:11)在工件。_getArtifactPathFromFiles(/用户//你好-世界/node_modules/建筑工人/src/内部/artifacts.ts: 827:19)在工件。_getArtifactPath(/用户//hello world/node_modules/建筑工人/src/内部/artifacts.ts 507:21):在工件。readArtifact(/用户//hello world/node_modules/建筑工人/src/内部/artifacts.ts 71:26):在getContractFactory (/Users/**/hello-world/node_modules/@nomiclabs/hardhat-ethers/src/内部/helpers.ts: 99:22)
这是我的deploy.js
代码:
async function main() {
const HelloWorld = await ethers.getContractFactory("HelloWorld");
const hello_world = await HelloWorld.deploy("Hello World!");
console.log("Contract deployed to address:", hello_world.address);
}
我甚至试着写:
const HelloWorld = await ethers.getContractFactory("HelloWorld.sol");
通常应该显示:
有人能帮我一下吗?谢谢!部署到地址:0x…
你忘记编译合同了。
npx hardhat compile