0

Please help me understand this error

`**enter code here**`No build configuration found. Preparing to compile contracts.

Compiling your contracts...
===========================
Error: Could not find 
import  from any sources; imported from /home/a/Documents/sos/contracts/crowdsale.sol
    at Resolver.<anonymous> (/usr/local/lib/node_modules/truffle/build/webpack:/packages/resolver/dist/lib/resolver.js:53:1)
    at Generator.next (<anonymous>)
    at fulfilled (/usr/local/lib/node_modules/truffle/build/webpack:/packages/resolver/dist/lib/resolver.js:5:42)
    at <anonymous>
Truffle v5.1.28 (core: 5.1.28)
Node v8.10.0

This is the error I get when I compile my contracts. this is the start of my crontracts.sol

pragma solidity >=0.4.21 <0.7.0;
import "../../node_modules/openzeppelin-solidity/contracts/crowdsale/Crowdsale.sol";
import "../../node_modules/openzeppelin-solidity/contracts/crowdsale/emission/MintedCrowdsale.sol";
import "../../node_modules/openzeppelin/contracts/crowdsale/validation/PausableCrowdsale.sol"
import "./token.sol"

npm installed openzeppelin modules as 0.6.0 sol and the truffle version is using 0.5.16 solc

0

You should avoid using .. in path specific as state in the note of this section: https://solidity.readthedocs.io/en/v0.6.10/layout-of-source-files.html#paths.

So what can you do instead? Just like in the note i show above you should use global map and then setup remapping to it they explain it here: https://solidity.readthedocs.io/en/v0.6.10/layout-of-source-files.html#use-in-actual-compilers.

But since you are using truffle i recommend an easy approach which is just copy the folder you need into contract folder and then import it like in this case you should copy crowdsale folder to contract folder in your project and change the import to this:

import "./crowdsale/CrowdSale.sol"

Which is much more readable instead of using ../

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.