PatrickAlphaC / hardhat-fund-me-fcc

82 stars 182 forks source link

Error HH303: Unrecognized task deploy #174

Open DengreSarthak opened 11 months ago

DengreSarthak commented 11 months ago

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 commented 11 months ago

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

DengreSarthak commented 11 months ago

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 commented 11 months ago

Try it this way then -

the mocks should be “mocks”


yarn hardhat deploy --tags “mocks”
DengreSarthak commented 11 months ago

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

vishnu-geek commented 11 months ago

try yarn add --dev deploy then deploy

qinfang0623 commented 10 months ago

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!