I'm following a tutorial on freeCodeCamp and on my contract:
I'm getting an error on import "hardhat/console.sol";
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.4;
import "hardhat/console.sol";
contract Greeter {
string private greeting;
constructor(string memory _greeting) {
console.log("Deploying a Greeter with greeting:", _greeting);
greeting = _greeting;
}
function greet() public view returns (string memory) {
return greeting;
}
function setGreeting(string memory _greeting) public {
console.log("Changing greeting from '%s' to '%s'", greeting, _greeting);
greeting = _greeting;
}
}
Error: Source "hardhat/console.sol" not found: File import callback not supported
When change the path to:
import "../node_modules/hardhat/console.sol";
It works but then I'm unable to compile
However if I go to the file directly like this:
import "C:/Users/limco/Desktop/Dev- Fullstack/react-dapp/node_modules/hardhat/console.sol";
It works and compiles, I don't understand why