Solidity – Fixing HH700 Artifact Not Found for Contract ‘@uniswap/lib/contracts/Babyl…’ Error in Hardhat

hardhatreactsolidityuniswap

I'm using Hardhat to compile solidity contracts.
In the contracts I'm importing Uniswap's contracts SDK to use them. But when I run

yarn hardhat compile 

in terminal it says

Error HH700: Artifact for contract "@uniswap/lib/contracts/libraries/Babylonian.sol:Babylonian" not found. 

For more info go to https://hardhat.org/HH700 or run Hardhat with --show-stack-traces
error Command failed with exit code 1.

Here is how I imported Uniswap

pragma solidity 0.6.6;

import '@uniswap/v2-periphery/contracts/UniswapV2Router02.sol';

contract THE_CONTRACT {
  string public name = "SOME PROPERTY";

and here is hardhat config

import "@nomicfoundation/hardhat-toolbox";
import { INFURA } from "./src/config";

const config = {
  solidity: "0.6.6",
  paths: {
    artifacts: "./src/artifects",
  },
  networks: {
    goerli: {
      chainID: 5,
      url: INFURA,
      accounts: [
        "0xTHEACCOUNT",
      ],
      timeout: 60000,
    },
  },
  settings: {
    optimizer: {
      enabled: true,
      runs: 1,
    },
    evmVersion: "byzantium",
  },
};

export default config;

Best Answer

  1. have you tried installing npm i @uniswap/v2-periphery? or in your case "yarn add"?
  2. do you have compiler version 0.6.6 in your hardhat config?
  3. try to remove cache and artifects folder and compile the contracts again

Might be one of these things...