I don't know what this error means or how to fix it.

I try to follow the tutorial located here and when I get to the point where I have to run "truffle test" I get the following error.

with TestAdoption "before all" hook: prepare suite:      Error: Could not find artifacts for ''EthereumPetShopTutorial/contracts/Adoption.sol" from any sources

Output of Truffle version

Truffle v4.1.5 (core: 4.1.5)
Solidity v0.4.21 (solc-js)

this is my 2_deploy_contracts.js file

var Adoption = artifacts.require("Adoption");

module.exports = function(deployer) {

this is my TestAdoption.sol file:

pragma solidity ^0.4.17;

import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";
import "../contracts/Adoption.sol";

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

  // Testing the adopt() function
    function testUserCanAdoptPet() public {
        uint returnedId = adoption.adopt(8);

        uint expected = 8;

        Assert.equal(returnedId, expected, "Adoption of pet ID 8 should be recorded.");


This is my file structure:

enter image description here


There is something wrong with the latest truffle version. To solve this problem I had to do the following things to find a truffle version that worked.

First check for available versions of truffle with the following command.

npm view truffle versions

Then for each item on the list starting from the latest version. I uninstalled truffle with

npm uninstall -g truffle

then installed the next oldest version with

npm install -g truffle@<version#>

then deleted the build folder

then compiled the project with

truffle compile

then ran

truffle test

if this fails move on to the next oldest version and repeat the test.

In my case a working version of truffle was 4.1.4


It can't find the contract. It should be in the ./contracts folder relative to your present working directory.

The compiler is going to create contract abstractions and put those in the ./build/contracts folder you.

It's being told to go there to find Adoption.sol by this line:

var Adoption = artifacts.require("Adoption");

Hope it helps.

p.s. If this doesn't do the trick, let us know the actual verison of truffle you're using (because changes).

$ truffle version

  • Truffle version gets me v4.1.5. I edited my question with additional information. I don't know why it can't find the contract. It exists in the expected directory. Apr 3 '18 at 2:54
  • I've found that sometimes I need to give it a "kick" for reasons I don't really understand because I've never dug too deep. You can destroy the ./build folder and then truffle compile. Apr 3 '18 at 3:33
  • No luck, unfortunately. Apr 3 '18 at 15:27

Same issue with 4.1.5, rolling back to 4.1.4 fixed it.

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.