TransWikia.com

Import error in Truffle Pet Shop tutorial

Ethereum Asked by xPain on January 29, 2021

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?

One 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";

Answered by Cody Popham on January 29, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP