Lesson 6: HardhatError: HH700: Artifact for contract "SimpleStorage" not found. #1937
-
I'm getting this error when running yarn hardhat run scripts/deploy.js: yarn hardhat run scripts/deploy.js
yarn run v1.22.15
warning ../../package.json: No license field
$ /Users/myusername/hh-fcc/hardhat-simple-storage-fcc/node_modules/.bin/hardhat run scripts/deploy.js
HardhatError: HH700: Artifact for contract "SimpleStorage" not found.
at Artifacts._handleWrongArtifactForContractName (/Users/myusername/hh-fcc/hardhat-simple-storage-fcc/node_modules/hardhat/src/internal/artifacts.ts:478:11)
at Artifacts._getArtifactPathFromFiles (/Users/myusername/hh-fcc/hardhat-simple-storage-fcc/node_modules/hardhat/src/internal/artifacts.ts:592:19)
at Artifacts._getArtifactPath (/Users/myusername/hh-fcc/hardhat-simple-storage-fcc/node_modules/hardhat/src/internal/artifacts.ts:275:17)
at Artifacts.readArtifact (/Users/myusername/hh-fcc/hardhat-simple-storage-fcc/node_modules/hardhat/src/internal/artifacts.ts:58:26)
at getContractFactory (/Users/myusername/hh-fcc/hardhat-simple-storage-fcc/node_modules/@nomiclabs/hardhat-ethers/src/internal/helpers.ts:99:22)
at main (/Users/myusername/hh-fcc/hardhat-simple-storage-fcc/scripts/deploy.js:6:35)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. deploy.js code: //imports
const { ethers } = require("hardhat")
//async main
async function main() {
const SimpleStorageFactory = await ethers.getContractFactory(
"SimpleStorage"
)
console.log("Deploying contract...")
const simpleStorage = await SimpleStorageFactory.deploy()
await simpleStorage.deployed()
}
//main
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error)
process.exit(1)
}) Part of video: https://youtu.be/gyMwXuJrbJQ?t=31273 |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
run |
Beta Was this translation helpful? Give feedback.
-
Delete node_modules, cache and artifacts. Then, do If the problem still persists, please push to GitHub and I will look into it. |
Beta Was this translation helpful? Give feedback.
-
Hi guys, actually I deleted everything and started from scratch again. |
Beta Was this translation helpful? Give feedback.
Hi guys, actually I deleted everything and started from scratch again.
Turns out I forgot to copy the SimpleStorage.sol code into the SimpleStorage file. It still had the Greeter.sol code in there.
Thanks for your help