'File won't get deployed? (HardhatError: HH700: Artifact not found.)

I'm following this tutorial here: https://ethereum.org/en/developers/tutorials/hello-world-smart-contract-fullstack/ and I'm stuck with this error message: HardhatError: HH700: Artifact for contract "HelloWorld" not found.

From what I found on the forums it seems to be a naming problem but the name for the contract & what is being deployed is the same:

pragma solidity >=0.7.3;


contract HelloWorld {

   
   event UpdatedMessages(string oldStr, string newStr);

   string public message;

   constructor(string memory initMessage) {


      message = initMessage;
   }


   function update(string memory newMessage) public {
      string memory oldMsg = message;
      message = newMessage;
      emit UpdatedMessages(oldMsg, newMessage);
   }
}

and this is the deploy.js file:

async function main() {
  const HelloWorld = await ethers.getContractFactory("HelloWorld")

  // Start deployment, returning a promise that resolves to a contract object
  const hello_world = await HelloWorld.deploy("Hello World!")
  console.log("Contract deployed to address:", hello_world.address)
}

main()
  .then(() => process.exit(0))
  .catch((error) => {
    console.error(error)
    process.exit(1)
  })

When I compile it just says "Nothing to compile" and running this command: npx hardhat run scripts/deploy.js --network ropsten given mentioned HH700 error. Can anyone please help?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source