简体   繁体   中英

Invalid Artifacts path

I am getting this error everytime pls look after it

Error HH702: Invalid artifact path E:\Block Chain Projects\SET OOD\artifacts\contracts\MOOD.sol\Mood.json, its correct case-sensitive path is E:\Block Chain Projects\SET OOD\artifacts\contracts\Mood.sol\Mood.json

THE ERROR

async function main()
{
  const {deployers} =await  ethers.getSigners();
  const MOODCONTRACT = await ethers.getContractFactory('Mood');
  const moodcontract =await  MOODCONTRACT.deploy();
  console.log("the contract is deployed"+moodcontract.address);
}
main().then(
  ()=>process.exit(0)
).catch(err => {
  console.log(err);
  process.exit(1);
})

MY deploy.js file

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;

contract Mood {
    string mood;
    function Setmood(string memory _mood) public {
        mood = _mood;
    }
    function Getmood() public view returns(string memory)
    {
        return mood;
    }
}

My Mood.sol look this if u want to see the files path

given your attached picture it seems to be a case sensitive problem. Check out the error information hardhat provides:

安全帽错误

see https://hardhat.org/hardhat-runner/docs/errors .

Given your picture the contracts seems correct, did you change the name once from "MOOD.sol" to "Mood.sol".

If your contract itself has the name "Mood" (contract Mood {}) then it should be fine and you can try firing: npx hardhat clean and then try your npx hardhat compile again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM