CompileError: ParserError: Source not found: File import callback not supported

Hi dear community,

I’m a little new developing smart contracts and using truffle with OpenZeppelin. I’m having this error and I don’t find a solution, I don’t know even what could I try to solve it. This is the error:

CompileError: openzeppelin-contracts/contracts/access/Ownable.sol:5:1: ParserError: Source "openzeppelin-contracts/contracts/utils/Context.sol" not found: File import callback not supported

import "../utils/Context.sol";

^----------------------------^

Steps to reproduce the error:

1- mkdir DIRNAME && cd DIRNAME
2- truffle init
3- create and code smart contract on “contracts” dir
4- git clone openzeppelin-contracts
5- truffle compile

Help please :S, and thank you.

1 Like

Hi @Marcelo_Pignataro,

Welcome to the community :wave:

Instead of doing a clone, you should install OpenZeppelin Contracts as follows:

npm install @openzeppelin/contracts

OpenZeppelin Contracts will then be installed in the node_modules directory and you can import into your contract.

See the documentation for details: https://docs.openzeppelin.com/contracts/3.x/#overview