I'm executing an example in the Truffle Pet Shop tutorial.

While testing with file TestAdoption.sol, I have encountered the following error:

Source truffle / Assert.sol not found

The source code causing the error is:

pragma solidity ^0.4.17;

import "truffle/Assert.sol"; // error source truffle / Assert.sol not found"
import "truffle/DeployedAddresses.sol";// error source truffle/DeployedAddresses.sol not found"
import "../contracts/Adoption.sol";

contract TestAdoption {
  Adoption adoption = Adoption(DeployedAddresses.Adoption());


Any suggestions to solve the problem?


Typically your files will all lie in the contracts/ directory within the truffle project root folder.

If the other contracts are in the same folder as this you need to change your import statements - ./ represents the current folder

import "./Assert.sol";
| improve this answer | |
  • Sorry for not checking it out. Although the code line error, the compile still works well. It took me a long time to fix it. I hope the software development team will fix this error. – xPain Jun 29 '18 at 6:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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