[Ethereum] Import error in Truffle Pet Shop tutorial

soliditytruffle

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?

Best Answer

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";
Related Topic