Skip to content
This repository has been archived by the owner on May 17, 2024. It is now read-only.

Error HH303: Unrecognized task deploy #174

Open
DengreSarthak opened this issue Jul 26, 2023 · 6 comments
Open

Error HH303: Unrecognized task deploy #174

DengreSarthak opened this issue Jul 26, 2023 · 6 comments

Comments

@DengreSarthak
Copy link

Getting the issue while running command --> yarn hardhat deploy --tags mocks or yarn hardhat deploy
Can't find any task which has incorrect words.

Code of 00-deploy-mocks.js

const { network } = require("hardhat");
const { developmentChains, DECIMALS, INITIAL_ANSWER } = require("../helper-hardhat-config");

module.exports = async({getNamedAccounts, deployments}) => {
const {deploy, log} = deployments;
const { deployer} = await getNamedAccounts();
const chainId = network.config.chainId;

// if(chainId == "31337") OR (below one)
if(developmentChains.includes(chainId))
{
    log("Local network detected.Deploying mocks .....!!");
     await deploy("MockV3Aggregator", {
        contract: "MockV3Aggregator",
        from: deployer,
        log: true,
        args: [DECIMALS, INITIAL_PRICE],
    })
    log("Mocks Deployed");
    log("-----------------------------------------------------------");
}

}

module.exports.tags = ["all", "mocks"];


Code of 01-deploy-mocks.js

//const { getNamedAccounts, deployments } = require("hardhat")

const { network } = require("hardhat");
const { networkconfig } = require("../helper-hardhat-config");

module.exports = async({getNamedAccounts, deployments}) => {
const {deploy, log} = deployments;
const { deployer} = await getNamedAccounts();
const chainId = network.config.chainId;

const ethUsdPriceFeedAddress = networkconfig[chainId]["ethUsdPriceFeed"];

const fundMe = await deploy("FundMe", {
    from: deployer,
    args: [ethUsdPriceFeedAddress],
    log: true,
    // we need to wait if on a live network so we can verify properly
    // waitConfirmations: network.config.blockConfirmations || 1,
})

}

Searched everywhere but can't find the solution.
Can anybody please help?

@the-first-elder
Copy link

I'll suggest you also show us the error from the console

@DengreSarthak
Copy link
Author

Following is the error shown on the console while running the following command.

yash@DESKTOP-RK1S1NU:~/BlockChain/Hardhat-fundme-fcc$ yarn hardhat deploy --tags mocks
yarn run v1.22.19
warning package.json: No license field
$ /home/yash/BlockChain/Hardhat-fundme-fcc/node_modules/.bin/hardhat deploy --tags mocks
Error HH303: Unrecognized task deploy

For more info go to https://hardhat.org/HH303 or run Hardhat with --show-stack-traces
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@the-first-elder
Copy link

Try it this way then -

the mocks should be “mocks”


yarn hardhat deploy --tags “mocks”

@DengreSarthak
Copy link
Author

Thank you but nothing changes still its showing the same error.

@vishnu-geek
Copy link

try yarn add --dev deploy
then deploy

@qinfang0623
Copy link

please add the following line to the top of the "hardhat.config.js" file:

require("hardhat-deploy");

I have the same issue. Solved by this!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants