None of the solutions that I saw solved this issue. When I do truffle compile I get this error

Error parsing @openzeppelin/contracts/GSN/Context.sol: ParsedContract.sol:15:1: ParserError: Expected pragma, import directive or contract/interface/library definition. abstract contract Context { ^------^

Should I be looking somewhere else? or do I have to install something?

// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
  • 1
    You are importing an openzeppelin version that is not compatible with the solc version you are using. Check the version supported by that openzeppelin version and either upgrade solc or downgrade openzeppelin. If you indicate which solc are you using I can suggest a compatible version.
    – Ismael
    Mar 7, 2021 at 20:19
  • 1
    thank you for your reply. I did "install truffle" and "brew solc" almost at the same time, and suddenly it was solved. I wasn't sure which of the two were the reason. It might be also that I didn't even have installed solc? thanks so much!
    – Maruta
    Mar 8, 2021 at 9:38

1 Answer 1


try downgrade openzepplin, i think you are trying some very old tutorial. i meet same case.

$npm install [email protected]

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.