Error i'm getting back when I run truffle compile

ParserError: Expected ';' but got 'contract'

How my contract looks:

pragma solidity ^0.6.0;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";

import "@openzeppelin/contracts/utils/Counters.sol"

contract SomeContract is ERC721{

   using Counters for Counters.Counter;
       Counters.Counter private _tokenIds;
       mapping(string => uint8) hashes;

   constructor() public ERC721("SomeContract", "SMC") {}

   function awardItem(address recipient, string memory hash, string memory metadata)
   returns (uint256)
       require(hashes[hash] != 1);
       hashes[hash] = 1;
       uint256 newItemId = _tokenIds.current();
       _mint(recipient, newItemId);
       _setTokenURI(newItemId, metadata);
       return newItemId;

My environment

  • Truffle v5.3.1
  • solidity 0.6.0
  • nodejs V15
  • web3 v1.3.5

It must have something to do with the versions of Truffle I am using with Solidity but I tried uninstalling and installing the packages but doesn't seem to work. Any help would be great. Thanks.

  • Your second import statement is missing the ;. Apr 10, 2021 at 17:09

1 Answer 1


you are missing ; in import

import "@openzeppelin/contracts/utils/Counters.sol"

should be :

import "@openzeppelin/contracts/utils/Counters.sol";

Moreover, use ^0.8.0 because openzepplin contracts are compiled in it and use @openzeppelin/contracts 3.0 (npm) as _setTokenURI is not available in v4 (replaced by other function)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.